Skip to content
Snippets Groups Projects
Verified Commit f3c9cf42 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Use customised colour widget for theme preferences

parent 6c102a9f
No related branches found
No related tags found
1 merge request!473Resolve "Customise django-colorfield for use with Materialize"
Pipeline #5717 passed
...@@ -3,6 +3,7 @@ from django.forms import EmailField, ImageField, URLField ...@@ -3,6 +3,7 @@ from django.forms import EmailField, ImageField, URLField
from django.forms.widgets import SelectMultiple from django.forms.widgets import SelectMultiple
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from colorfield.widgets import ColorWidget
from dynamic_preferences.preferences import Section from dynamic_preferences.preferences import Section
from dynamic_preferences.types import ( from dynamic_preferences.types import (
BooleanPreference, BooleanPreference,
...@@ -53,6 +54,7 @@ class ColourPrimary(StringPreference): ...@@ -53,6 +54,7 @@ class ColourPrimary(StringPreference):
default = "#0d5eaf" default = "#0d5eaf"
required = False required = False
verbose_name = _("Primary colour") verbose_name = _("Primary colour")
widget = ColorWidget
@site_preferences_registry.register @site_preferences_registry.register
...@@ -62,6 +64,7 @@ class ColourSecondary(StringPreference): ...@@ -62,6 +64,7 @@ class ColourSecondary(StringPreference):
default = "#0d5eaf" default = "#0d5eaf"
required = False required = False
verbose_name = _("Secondary colour") verbose_name = _("Secondary colour")
widget = ColorWidget
@site_preferences_registry.register @site_preferences_registry.register
......
...@@ -25,4 +25,6 @@ ...@@ -25,4 +25,6 @@
{% include "core/partials/save_button.html" with caption=_("Save preferences") %} {% include "core/partials/save_button.html" with caption=_("Save preferences") %}
</form> </form>
</div> </div>
{{ form.media.js }}
{% endblock %} {% endblock %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment