diff --git a/manager/manager/builder.py b/manager/manager/builder.py index a461ba7..e81c933 100644 --- a/manager/manager/builder.py +++ b/manager/manager/builder.py @@ -24,7 +24,6 @@ class ConfigLike: admin_password: str = "admin-password" branding_logo: str = "" branding_favicon: str = "" - branding_css: str = "" content_zims: list[str] = field(default_factory=list) # parsed json content_wikifundi_fr: bool = False content_wikifundi_en: bool = False diff --git a/manager/manager/migrations/0024_remove_configuration_branding_css.py b/manager/manager/migrations/0024_remove_configuration_branding_css.py new file mode 100644 index 0000000..f223e7c --- /dev/null +++ b/manager/manager/migrations/0024_remove_configuration_branding_css.py @@ -0,0 +1,16 @@ +# Generated by Django 4.2.5 on 2024-01-03 14:25 + +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [ + ("manager", "0023_configuration_content_metrics"), + ] + + operations = [ + migrations.RemoveField( + model_name="configuration", + name="branding_css", + ), + ] diff --git a/manager/manager/models.py b/manager/manager/models.py index f3395eb..074aefc 100644 --- a/manager/manager/models.py +++ b/manager/manager/models.py @@ -284,12 +284,6 @@ class Meta: upload_to=get_branding_path, verbose_name=_lz("Favicon (1MB max Image)"), ) - branding_css = models.FileField( - blank=True, - null=True, - upload_to=get_branding_path, - verbose_name=_lz("CSS File"), - ) content_zims = models.JSONField( blank=True, @@ -419,7 +413,6 @@ def create_from(cls, config, author): "branding_favicon": save_branding_file(favicon) if favicon is not None else None, - "branding_css": save_branding_file(css) if css is not None else None, "content_zims": packages_list, "content_wikifundi_fr": "fr" in wikifundi_langs, "content_wikifundi_en": "en" in wikifundi_langs, @@ -445,7 +438,7 @@ def create_from(cls, config, author): logger.warn(exp) # remove saved branding files - for key in ("branding_logo", "branding_favicon", "branding_css"): + for key in ("branding_logo", "branding_favicon"): if kwargs.get(key): try: Path(settings.MEDIA_ROOT).joinpath(kwargs.get(key)) @@ -593,7 +586,6 @@ def to_dict(self): [ ("logo", retrieve_branding_file(self.branding_logo)), ("favicon", retrieve_branding_file(self.branding_favicon)), - ("css", retrieve_branding_file(self.branding_css)), ] ), ), diff --git a/manager/manager/templates/configuration_edit.html b/manager/manager/templates/configuration_edit.html index 06c7769..fd76291 100644 --- a/manager/manager/templates/configuration_edit.html +++ b/manager/manager/templates/configuration_edit.html @@ -103,13 +103,10 @@

{% blocktrans %}Branding{% endblocktrans %}

{% blocktrans %}Advanced Branding{% endblocktrans %}

{% blocktrans %}Change favicon and CSS only of you know what you are doing.{% endblocktrans %}

-
+
{% include "_input_field.html" with field=form.branding_favicon type=file use_raw=1 %} {% include "_file_preview.html" with field=form.branding_favicon class="favicon" %}
-
- {% include "_input_field.html" with field=form.branding_css type=file use_raw=1 %} -
diff --git a/manager/manager/views/config.py b/manager/manager/views/config.py index 3f98200..acb5150 100644 --- a/manager/manager/views/config.py +++ b/manager/manager/views/config.py @@ -45,7 +45,6 @@ class Meta: "admin_password", "branding_logo", "branding_favicon", - "branding_css", "content_zims", "content_wikifundi_fr", "content_wikifundi_en", @@ -58,11 +57,6 @@ class Meta: "content_africatikmd", "content_metrics", ] - widgets = { # noqa: RUF012 - "branding_css": forms.ClearableFileInput( - attrs={"accept": "text/css,text/plain"} - ), - } def handle_uploaded_json(fd):