diff --git a/netbox/users/admin.py b/netbox/users/admin.py index c1b659a8e..4c3da5acd 100644 --- a/netbox/users/admin.py +++ b/netbox/users/admin.py @@ -90,7 +90,9 @@ class ObjectPermissionForm(forms.ModelForm): model = ObjectPermission exclude = [] help_texts = { - 'actions': 'Actions granted in addition to those listed above' + 'actions': 'Actions granted in addition to those listed above', + 'attrs': 'JSON expression of a queryset filter that will return only permitted objects. Leave null to ' + 'match all objects of this type.' } labels = { 'actions': 'Additional actions' @@ -106,6 +108,10 @@ class ObjectPermissionForm(forms.ModelForm): order_content_types(self.fields['content_types']) self.fields['content_types'].choices.insert(0, ('', '---------')) + # Order group and user fields + self.fields['groups'].queryset = self.fields['groups'].queryset.order_by('name') + self.fields['users'].queryset = self.fields['users'].queryset.order_by('username') + # Check the appropriate checkboxes when editing an existing ObjectPermission if self.instance.pk: for action in ['view', 'add', 'change', 'delete']: