mirror of
https://github.com/netbox-community/netbox.git
synced 2025-09-06 06:13:36 -06:00
Defer compilation of choices for object_types
This commit is contained in:
parent
5cf8dc44ba
commit
5d08a80c9e
@ -272,15 +272,19 @@ class GroupForm(forms.ModelForm):
|
||||
return instance
|
||||
|
||||
|
||||
def get_object_types_choices():
|
||||
return [
|
||||
(ot.pk, str(ot))
|
||||
for ot in ObjectType.objects.filter(OBJECTPERMISSION_OBJECT_TYPES).order_by('app_label', 'model')
|
||||
]
|
||||
|
||||
|
||||
class ObjectPermissionForm(forms.ModelForm):
|
||||
object_types = ContentTypeMultipleChoiceField(
|
||||
label=_('Object types'),
|
||||
queryset=ObjectType.objects.all(),
|
||||
widget=SplitMultiSelectWidget(
|
||||
choices=[
|
||||
(ot.pk, str(ot))
|
||||
for ot in ObjectType.objects.filter(OBJECTPERMISSION_OBJECT_TYPES).order_by('app_label', 'model')
|
||||
]
|
||||
choices=get_object_types_choices
|
||||
),
|
||||
help_text=_('Select the types of objects to which the permission will appy.')
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user