Improve the way the AssignRemove view gets the list's help texts. Don't use None for extra context if there is none.

This commit is contained in:
Roberto Rosario
2015-07-13 01:16:17 -04:00
parent 713977ed46
commit ac1f4eb59a
2 changed files with 9 additions and 5 deletions

View File

@@ -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):