Enhance Admin UI: Singleton PlatformProfile and Sidebar Icons

This commit is contained in:
Flatlogic Bot 2026-02-01 02:41:14 +00:00
parent bd260781ff
commit 73bbc63c0c
2 changed files with 14 additions and 6 deletions

View File

@ -254,8 +254,6 @@ JAZZMIN_SETTINGS = {
"topmenu_links": [
{"name": "Home", "url": "admin:index", "permissions": ["auth.view_user"]},
{"name": "View Website", "url": "index", "new_window": True},
{"model": "auth.User"},
{"app": "core"},
],
"usermenu_links": [
{"model": "auth.User"}
@ -269,13 +267,16 @@ JAZZMIN_SETTINGS = {
"auth": "fas fa-users-cog",
"auth.user": "fas fa-user",
"auth.Group": "fas fa-users",
"core.Parcel": "fas fa-box",
"core.Parcel": "fas fa-box-open",
"core.Profile": "fas fa-id-card",
"core.PlatformProfile": "fas fa-building",
"core.PlatformProfile": "fas fa-cogs",
"core.Country": "fas fa-globe",
"core.City": "fas fa-city",
"core.Governate": "fas fa-map-marked-alt",
"core.DriverRating": "fas fa-star",
"core.Testimonial": "fas fa-comment",
"core.Testimonial": "fas fa-comment-dots",
"core.NotificationTemplate": "fas fa-envelope-open-text",
"core.PricingRule": "fas fa-tags",
},
"default_icon_parents": "fas fa-chevron-circle-right",
"default_icon_children": "fas fa-circle",

View File

@ -4,7 +4,7 @@ from django.contrib.auth.models import User
from .models import Profile, Parcel, Country, Governate, City, PlatformProfile, Testimonial, DriverRating, NotificationTemplate, PricingRule
from django.utils.translation import gettext_lazy as _
from django.urls import path, reverse
from django.shortcuts import render
from django.shortcuts import render, redirect
from django.utils.html import format_html
from django.contrib import messages
from .whatsapp_utils import send_whatsapp_message_detailed
@ -194,6 +194,13 @@ class PlatformProfileAdmin(admin.ModelAdmin):
return False
return super().has_add_permission(request)
def changelist_view(self, request, extra_context=None):
# Redirect directly to the change page if a profile exists
profile = self.model.objects.first()
if profile:
return redirect('admin:core_platformprofile_change', profile.pk)
return super().changelist_view(request, extra_context)
def get_urls(self):
urls = super().get_urls()
custom_urls = [