mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-18 05:28:16 -06:00
Remove obsolete value-field attr on dynamic select widgets
This commit is contained in:
parent
26e2acace6
commit
0a23318e8c
@ -186,8 +186,7 @@ class UserForm(forms.ModelForm):
|
|||||||
object_permissions = DynamicModelMultipleChoiceField(
|
object_permissions = DynamicModelMultipleChoiceField(
|
||||||
required=False,
|
required=False,
|
||||||
label=_('Permissions'),
|
label=_('Permissions'),
|
||||||
queryset=ObjectPermission.objects.all(),
|
queryset=ObjectPermission.objects.all()
|
||||||
to_field_name='pk',
|
|
||||||
)
|
)
|
||||||
|
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
@ -244,8 +243,7 @@ class GroupForm(forms.ModelForm):
|
|||||||
object_permissions = DynamicModelMultipleChoiceField(
|
object_permissions = DynamicModelMultipleChoiceField(
|
||||||
required=False,
|
required=False,
|
||||||
label=_('Permissions'),
|
label=_('Permissions'),
|
||||||
queryset=ObjectPermission.objects.all(),
|
queryset=ObjectPermission.objects.all()
|
||||||
to_field_name='pk',
|
|
||||||
)
|
)
|
||||||
|
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
|
@ -92,9 +92,6 @@ class DynamicModelChoiceMixin:
|
|||||||
self.fetch_trigger = fetch_trigger
|
self.fetch_trigger = fetch_trigger
|
||||||
self.selector = selector
|
self.selector = selector
|
||||||
|
|
||||||
# to_field_name is set by ModelChoiceField.__init__(), but we need to set it early for reference
|
|
||||||
# by widget_attrs()
|
|
||||||
self.to_field_name = kwargs.get('to_field_name')
|
|
||||||
self.empty_option = empty_label or ""
|
self.empty_option = empty_label or ""
|
||||||
|
|
||||||
super().__init__(queryset, **kwargs)
|
super().__init__(queryset, **kwargs)
|
||||||
@ -104,10 +101,6 @@ class DynamicModelChoiceMixin:
|
|||||||
'data-empty-option': self.empty_option
|
'data-empty-option': self.empty_option
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set value-field attribute if the field specifies to_field_name
|
|
||||||
if self.to_field_name:
|
|
||||||
attrs['value-field'] = self.to_field_name
|
|
||||||
|
|
||||||
# Set the string used to represent a null option
|
# Set the string used to represent a null option
|
||||||
if self.null_option is not None:
|
if self.null_option is not None:
|
||||||
attrs['data-null-option'] = self.null_option
|
attrs['data-null-option'] = self.null_option
|
||||||
|
Loading…
Reference in New Issue
Block a user