feat: dynamic citation text and logo

This commit is contained in:
mohamad
2026-05-20 16:02:16 +03:30
parent 2341b32d4c
commit 24dd24e1c9
11 changed files with 181 additions and 29 deletions
+29
View File
@@ -1,4 +1,6 @@
from django.contrib import admin
from django.http import HttpResponseRedirect
from django.urls import reverse
from .models import (
AboutSection,
@@ -6,11 +8,38 @@ from .models import (
ContactSubmission,
DownloadItem,
FAQEntry,
HeroSection,
HomepageSection,
HomepageSectionItem,
)
@admin.register(HeroSection)
class HeroSectionAdmin(admin.ModelAdmin):
fieldsets = (
("Badge", {"fields": ("badge",)}),
("Title", {"fields": ("title", "title_highlight")}),
("Text", {"fields": ("subtitle", "description")}),
("Primary Button", {"fields": ("primary_cta_text", "primary_cta_url")}),
("Secondary Button", {"fields": ("secondary_cta_text", "secondary_cta_url")}),
("Image", {"fields": ("image", "image_alt")}),
)
def has_add_permission(self, request):
return not HeroSection.objects.exists()
def has_delete_permission(self, request, obj=None):
return False
def changelist_view(self, request, extra_context=None):
hero = HeroSection.objects.first()
if hero:
return HttpResponseRedirect(
reverse("admin:pages_herosection_change", args=[hero.pk])
)
return super().changelist_view(request, extra_context)
class HomepageSectionItemInline(admin.TabularInline):
model = HomepageSectionItem
extra = 1