diff --git a/HISTORY.rst b/HISTORY.rst index 7bbb67c7ec..1d6ed2f5a7 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -290,6 +290,9 @@ * Sort events list in the transition trigger view. * Add support for form media to DynamicFormMixin. * Fix tag attach and remove action form media. +* Sort content type list of the access grant and remove action. +* Use select2 for the content type filed of the access + grant and remove action. 3.1.11 (2019-04-XX) =================== diff --git a/docs/releases/3.2.rst b/docs/releases/3.2.rst index c19c9bc8ac..c5ffbddeed 100644 --- a/docs/releases/3.2.rst +++ b/docs/releases/3.2.rst @@ -719,7 +719,9 @@ Other changes - Sort events list in the transition trigger view. - Add support for form media to DynamicFormMixin. - Fix tag attach and remove action form media. - +- Sort content type list of the access grant and remove action. +- Use select2 for the content type filed of the access + grant and remove action. Removals -------- diff --git a/mayan/apps/acls/workflow_actions.py b/mayan/apps/acls/workflow_actions.py index 972668353a..aee7761f90 100644 --- a/mayan/apps/acls/workflow_actions.py +++ b/mayan/apps/acls/workflow_actions.py @@ -58,6 +58,11 @@ class GrantAccessAction(WorkflowAction): field_order = ('content_type', 'object_id', 'roles', 'permissions') label = _('Grant access') widgets = { + 'content_type': { + 'class': 'django.forms.widgets.Select', 'kwargs': { + 'attrs': {'class': 'select2'}, + } + }, 'roles': { 'class': 'django.forms.widgets.SelectMultiple', 'kwargs': { 'attrs': {'class': 'select2'}, @@ -97,7 +102,9 @@ class GrantAccessAction(WorkflowAction): return form_data def get_form_schema(self, *args, **kwargs): - self.fields['content_type']['kwargs']['queryset'] = ModelPermission.get_classes(as_content_type=True) + self.fields['content_type']['kwargs']['queryset'] = ModelPermission.get_classes( + as_content_type=True + ).order_by('model') self.fields['permissions']['kwargs']['choices'] = Permission.all( as_choices=True )