Browse Source

admin panel fixes

dovodi rooting for admin panel resolved

articles dropdown is wider and make articles easy to read.
master
Mohsen Taba 1 month ago
parent
commit
050a857300
  1. 4
      apps/article/admin.py
  2. 20
      config/settings/base.py
  3. 7
      utils/admin.py

4
apps/article/admin.py

@ -29,11 +29,11 @@ from apps.article.models import (
) )
class ArticleInCollectionInline(TabularInline):
class ArticleInCollectionInline(StackedInline):
model = ArticleInCollection model = ArticleInCollection
extra = 1 extra = 1
autocomplete_fields = ('article',) autocomplete_fields = ('article',)
fields = ('article', 'order')
fields = (('article', 'order'),)
ordering = ('order',) ordering = ('order',)
verbose_name = _('Article') verbose_name = _('Article')
verbose_name_plural = _('Articles') verbose_name_plural = _('Articles')

20
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"), "title": _("Articles"),
"collapsible": True, "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": "", "title": "",
"items": [ "items": [

7
utils/admin.py

@ -23,10 +23,11 @@ from unfold.sites import UnfoldAdminSite
def is_dovoodi_panel(request): def is_dovoodi_panel(request):
""" """
Returns True if the user is accessing the Dovoodi admin panel. 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): def is_main_panel(request):
"""Returns True if the user is accessing the Main (Imam Javad) admin panel.""" """Returns True if the user is accessing the Main (Imam Javad) admin panel."""

Loading…
Cancel
Save