Skip to content
Snippets Groups Projects
Commit 662f796e authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Merge branch '581-icons-logo-should-be-uploaded-to-public' into 'master'

Resolve "Icons/logo should be uploaded to public/"

Closes #581

See merge request !837
parents a78893d6 6fee1cf3
No related branches found
No related tags found
1 merge request!837Resolve "Icons/logo should be uploaded to public/"
Pipeline #46267 passed with warnings
Pipeline: AlekSIS

#46308

    ...@@ -19,6 +19,7 @@ Fixed ...@@ -19,6 +19,7 @@ Fixed
    * Correctly update theme colours on change again * Correctly update theme colours on change again
    * Imprint is now called "Imprint" and not "Impress". * Imprint is now called "Imprint" and not "Impress".
    * Logo files weren't uploaded to public namespace.
    `2.3.1`_ – 2021-12-17 `2.3.1`_ – 2021-12-17
    --------------------- ---------------------
    ......
    # flake8: noqa: DJ12 # flake8: noqa: DJ12
    import os
    from datetime import datetime from datetime import datetime
    from typing import Any, Callable, List, Optional, Union from typing import Any, Callable, List, Optional, Union
    ...@@ -21,6 +22,8 @@ from django.views.generic import CreateView, UpdateView ...@@ -21,6 +22,8 @@ from django.views.generic import CreateView, UpdateView
    from django.views.generic.edit import DeleteView, ModelFormMixin from django.views.generic.edit import DeleteView, ModelFormMixin
    import reversion import reversion
    from dynamic_preferences.settings import preferences_settings
    from dynamic_preferences.types import FilePreference
    from guardian.admin import GuardedModelAdmin from guardian.admin import GuardedModelAdmin
    from guardian.core import ObjectPermissionChecker from guardian.core import ObjectPermissionChecker
    from jsonstore.fields import IntegerField, JSONFieldMixin from jsonstore.fields import IntegerField, JSONFieldMixin
    ...@@ -529,3 +532,14 @@ class SchoolTermRelatedExtensibleForm(ExtensibleForm): ...@@ -529,3 +532,14 @@ class SchoolTermRelatedExtensibleForm(ExtensibleForm):
    kwargs["initial"] = {"school_term": SchoolTerm.current} kwargs["initial"] = {"school_term": SchoolTerm.current}
    super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
    class PublicFilePreferenceMixin(FilePreference):
    """Uploads a file to the public namespace."""
    upload_path = "public"
    def get_upload_path(self):
    return os.path.join(
    self.upload_path, preferences_settings.FILE_PREFERENCE_UPLOAD_DIR, self.identifier()
    )
    ...@@ -16,6 +16,7 @@ from dynamic_preferences.types import ( ...@@ -16,6 +16,7 @@ from dynamic_preferences.types import (
    ) )
    from oauth2_provider.models import AbstractApplication from oauth2_provider.models import AbstractApplication
    from .mixins import PublicFilePreferenceMixin
    from .models import Group, Person from .models import Group, Person
    from .registries import person_preferences_registry, site_preferences_registry from .registries import person_preferences_registry, site_preferences_registry
    from .util.notifications import get_notification_choices_lazy from .util.notifications import get_notification_choices_lazy
    ...@@ -78,7 +79,7 @@ class ColourSecondary(StringPreference): ...@@ -78,7 +79,7 @@ class ColourSecondary(StringPreference):
    @site_preferences_registry.register @site_preferences_registry.register
    class Logo(FilePreference): class Logo(PublicFilePreferenceMixin, FilePreference):
    """Logo of your AlekSIS instance.""" """Logo of your AlekSIS instance."""
    section = theme section = theme
    ...@@ -88,7 +89,7 @@ class Logo(FilePreference): ...@@ -88,7 +89,7 @@ class Logo(FilePreference):
    @site_preferences_registry.register @site_preferences_registry.register
    class Favicon(FilePreference): class Favicon(PublicFilePreferenceMixin, FilePreference):
    """Favicon of your AlekSIS instance.""" """Favicon of your AlekSIS instance."""
    section = theme section = theme
    ...@@ -98,7 +99,7 @@ class Favicon(FilePreference): ...@@ -98,7 +99,7 @@ class Favicon(FilePreference):
    @site_preferences_registry.register @site_preferences_registry.register
    class PWAIcon(FilePreference): class PWAIcon(PublicFilePreferenceMixin, FilePreference):
    """PWA-Icon of your AlekSIS instance.""" """PWA-Icon of your AlekSIS instance."""
    section = theme section = theme
    ......
    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