Beispiel #1
0
    def __init__(self, *args, **kwargs):
        colours = get_available_colours()

        for name, info in colours.items():
            field = forms.RegexField(regex='^#([0-9a-fA-F]{6})$',
                                     help_text=info)
            self.base_fields[name] = field

        super(BrandingColoursForm, self).__init__(*args, **kwargs)
Beispiel #2
0
    def __init__(self, *args, **kwargs):
        colours = get_available_colours()

        for name, info in colours.items():
            field = forms.RegexField(regex='^#([0-9a-fA-F]{6})$',
                                     help_text=info)
            self.base_fields[name] = field

        super(BrandingColoursForm, self).__init__(*args, **kwargs)
Beispiel #3
0
    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
Beispiel #4
0
    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