From ac1f4eb59aeb79c6aa63e887d492577dd6fb4345 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Mon, 13 Jul 2015 01:16:17 -0400 Subject: [PATCH] Improve the way the AssignRemove view gets the list's help texts. Don't use None for extra context if there is none. --- mayan/apps/acls/views.py | 2 +- mayan/apps/common/generics.py | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/mayan/apps/acls/views.py b/mayan/apps/acls/views.py index 2dfaf8fcc8..9d6ac25960 100644 --- a/mayan/apps/acls/views.py +++ b/mayan/apps/acls/views.py @@ -155,7 +155,7 @@ class ACLPermissionsView(AssignRemoveView): return super(ACLPermissionsView, self).dispatch(request, *args, **kwargs) - def get_help_text(self): + def get_right_list_help_text(self): if self.get_object().get_inherited_permissions(): return _('Disabled permissions are inherited from a parent object.') diff --git a/mayan/apps/common/generics.py b/mayan/apps/common/generics.py index 2b203c7706..20bbfdd8a4 100644 --- a/mayan/apps/common/generics.py +++ b/mayan/apps/common/generics.py @@ -28,7 +28,8 @@ __all__ = ( class AssignRemoveView(ExtraContextMixin, ViewPermissionCheckMixin, ObjectPermissionCheckMixin, TemplateView): decode_content_type = False - extra_context = None + right_list_help_text = None + left_list_help_text = None grouped = False left_list_title = None right_list_title = None @@ -71,12 +72,15 @@ class AssignRemoveView(ExtraContextMixin, ViewPermissionCheckMixin, ObjectPermis def get_disabled_choices(self): return () - def get_help_text(self): - return self.help_text + def get_left_list_help_text(self): + return self.left_list_help_text + + def get_right_list_help_text(self): + return self.right_list_help_text def get(self, request, *args, **kwargs): self.unselected_list = ChoiceForm(prefix=self.LEFT_LIST_NAME, choices=self.left_list()) - self.selected_list = ChoiceForm(prefix=self.RIGHT_LIST_NAME, choices=self.right_list(), disabled_choices=self.get_disabled_choices(), help_text=self.get_help_text()) + self.selected_list = ChoiceForm(prefix=self.RIGHT_LIST_NAME, choices=self.right_list(), disabled_choices=self.get_disabled_choices(), help_text=self.get_right_list_help_text()) return self.render_to_response(self.get_context_data()) def process_form(self, prefix, items_function, action_function):