Add initial migrations, admin configurations, and base CSS for the project
This commit is contained in:
parent
16897b6010
commit
8fe6fe5390
19 changed files with 2101 additions and 68 deletions
26
core/admin.py
Normal file
26
core/admin.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
from django.contrib import admin
|
||||
from .models import SiteSettings
|
||||
|
||||
@admin.register(SiteSettings)
|
||||
class SiteSettingsAdmin(admin.ModelAdmin):
|
||||
# On empêche d'ajouter une nouvelle config s'il en existe déjà une
|
||||
def has_add_permission(self, request):
|
||||
return not SiteSettings.objects.exists()
|
||||
|
||||
# On empêche de supprimer la config (trop dangereux)
|
||||
def has_delete_permission(self, request, obj=None):
|
||||
return False
|
||||
|
||||
# Petite astuce visuelle pour l'admin
|
||||
fieldsets = (
|
||||
('Général', {
|
||||
'fields': ('site_name', 'site_logo')
|
||||
}),
|
||||
('Réseaux Sociaux', {
|
||||
'fields': ('facebook_url', 'twitter_url', 'youtube_url'),
|
||||
'classes': ('collapse',) # Cache cette section par défaut pour alléger
|
||||
}),
|
||||
('Contact', {
|
||||
'fields': ('contact_email',)
|
||||
}),
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue