chore: admin interface changes
This commit is contained in:
@@ -4,3 +4,23 @@ from django.apps import AppConfig
|
||||
class AccountsConfig(AppConfig):
|
||||
default_auto_field = "django.db.models.BigAutoField"
|
||||
name = "accounts"
|
||||
|
||||
def ready(self):
|
||||
# django-admin-interface's Theme.logo/favicon are plain FileFields,
|
||||
# so without this they'd resolve through STORAGES["default"] (S3 -
|
||||
# see settings.py) like every submission/media upload. The theme's
|
||||
# logo/favicon (see accounts/fixtures/admin_interface_theme.json)
|
||||
# are actually a static asset (static/favicon.ico, built from
|
||||
# public/favicon.ico by Vite - see vite.config.ts), so point those
|
||||
# two fields at STATIC_ROOT/STATIC_URL instead, served by WhiteNoise
|
||||
# like any other static file.
|
||||
from django.conf import settings
|
||||
from django.core.files.storage import FileSystemStorage
|
||||
|
||||
from admin_interface.models import Theme
|
||||
|
||||
static_storage = FileSystemStorage(
|
||||
location=settings.STATIC_ROOT, base_url=settings.STATIC_URL
|
||||
)
|
||||
Theme._meta.get_field("logo").storage = static_storage
|
||||
Theme._meta.get_field("favicon").storage = static_storage
|
||||
|
||||
Reference in New Issue
Block a user