Skip to content

Commit

Permalink
fix issue#2 optional config error
Browse files Browse the repository at this point in the history
  • Loading branch information
yaghoubi committed Nov 26, 2024
1 parent 7aecc15 commit 9bf8da8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion django_daisy/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from django.db import models
from django.shortcuts import render
from django.urls import reverse
from django.utils.timezone import override

from django_daisy.module_settings import DAISY_SETTINGS

Expand Down Expand Up @@ -76,14 +77,15 @@ def _build_app_dict(self, request, label=None):
return app_dict

modified_app_dict = app_dict.copy()
override_apps_config = getattr(settings, 'APPS_REORDER', {})

for app_label, app_info in app_dict.items():
# Add icon and divider title to each app
app_info['icon'] = getattr(apps.get_app_config(app_label), 'icon', '')
app_info['divider_title'] = getattr(apps.get_app_config(app_label), 'divider_title', '')

# Apply additional settings to individual apps from APPS_REORDER in settings.py
if app_label in settings.APPS_REORDER:
if app_label in override_apps_config:
app_info.update(settings.APPS_REORDER[app_label])

return modified_app_dict
Expand Down

0 comments on commit 9bf8da8

Please sign in to comment.