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
29
core/models.py
Normal file
29
core/models.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
from django.db import models
|
||||
|
||||
class SiteSettings(models.Model):
|
||||
site_name = models.CharField(max_length=200, default="Mon Super Site")
|
||||
site_logo = models.ImageField(upload_to='settings/', blank=True)
|
||||
contact_email = models.EmailField(blank=True)
|
||||
|
||||
# Réseaux sociaux
|
||||
facebook_url = models.URLField(blank=True)
|
||||
twitter_url = models.URLField(blank=True)
|
||||
youtube_url = models.URLField(blank=True)
|
||||
instagram_url = models.URLField(blank=True)
|
||||
linkedin_url = models.URLField(blank=True)
|
||||
github_url = models.URLField(blank=True)
|
||||
|
||||
# L'astuce pour qu'il n'y ait qu'un seul réglage
|
||||
def save(self, *args, **kwargs):
|
||||
self.pk = 1 # On force l'ID à 1. Si tu sauvegardes, ça écrase l'existant.
|
||||
super(SiteSettings, self).save(*args, **kwargs)
|
||||
|
||||
def delete(self, *args, **kwargs):
|
||||
pass # On empêche la suppression. On ne peut pas supprimer les réglages.
|
||||
|
||||
def __str__(self):
|
||||
return "Configuration Générale"
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Réglages du site"
|
||||
verbose_name_plural = "Réglages du site"
|
||||
Loading…
Add table
Add a link
Reference in a new issue