def get_context_data(self, **kwargs): context = super(BrandingManagementIndexView, self).get_context_data(**kwargs) colour_values = get_brand_colours() colour_descriptions = get_available_colours() colours = [] for key, value in colour_values.items(): try: colours.append((value, colour_descriptions[key])) except KeyError: # We've presumably removed a colour that was once # defined. pass context['colours'] = colours return context
def get_initial(self): initial = super(BrandingManagementUpdateColoursView, self).get_initial() initial.update(get_brand_colours()) return initial
def get_form(self, form_class): form = super(BrandingManagementUpdateColoursView, self).get_form(form_class) form.initial = get_brand_colours() return form