From 050a85730067927ef046c043324aa0e3647765db Mon Sep 17 00:00:00 2001 From: mohsentaba Date: Mon, 6 Apr 2026 09:45:09 +0330 Subject: [PATCH] admin panel fixes dovodi rooting for admin panel resolved articles dropdown is wider and make articles easy to read. --- apps/article/admin.py | 4 ++-- config/settings/base.py | 20 ++++++++++---------- utils/admin.py | 7 ++++--- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/apps/article/admin.py b/apps/article/admin.py index 5450b81..8b64dba 100755 --- a/apps/article/admin.py +++ b/apps/article/admin.py @@ -29,11 +29,11 @@ from apps.article.models import ( ) -class ArticleInCollectionInline(TabularInline): +class ArticleInCollectionInline(StackedInline): model = ArticleInCollection extra = 1 autocomplete_fields = ('article',) - fields = ('article', 'order') + fields = (('article', 'order'),) ordering = ('order',) verbose_name = _('Article') verbose_name_plural = _('Articles') diff --git a/config/settings/base.py b/config/settings/base.py index f6513ff..d9047a6 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -782,16 +782,6 @@ UNFOLD = { }, ] }, - { - "title": _(""), - "items": [ - { - "title": _("App Versions"), - "icon": "system_update", - "link": lambda request: admin_url_generator(request, "api_appversion_changelist"), - }, - ], - }, { "title": _("Articles"), "collapsible": True, @@ -954,6 +944,16 @@ UNFOLD = { }, ] }, + { + "title": _(""), + "items": [ + { + "title": _("App Versions"), + "icon": "system_update", + "link": lambda request: admin_url_generator(request, "api_appversion_changelist"), + }, + ], + }, { "title": "", "items": [ diff --git a/utils/admin.py b/utils/admin.py index 5990e82..f238c1a 100644 --- a/utils/admin.py +++ b/utils/admin.py @@ -23,10 +23,11 @@ from unfold.sites import UnfoldAdminSite def is_dovoodi_panel(request): """ Returns True if the user is accessing the Dovoodi admin panel. - Checks if '/dovoodi/' exists anywhere in the path to handle i18n prefixes - (e.g., /en/dovoodi/admin, /fa/dovoodi/admin). + Checks if 'dovodi' or 'dovoodi' is in the host domain, or if '/dovoodi/' + exists anywhere in the path. """ - return '/dovoodi/' in request.path + host = request.get_host() + return 'dovodi' in host or 'dovoodi' in host or '/dovoodi/' in request.path def is_main_panel(request): """Returns True if the user is accessing the Main (Imam Javad) admin panel."""