site_tps/settings/models.py

34 lines
886 B
Python
Raw Normal View History

2018-01-14 12:19:11 +00:00
from django.db import models
2018-01-22 20:26:37 +00:00
from .aes_field import AESEncryptedField
class SiteSettings(models.Model):
2018-02-28 14:06:55 +00:00
PRETTY_NAME = "Réglages du site"
allow_upload = models.BooleanField(
2018-01-20 22:08:46 +00:00
verbose_name="Autoriser l'upload de vidéos.",
default=False,
)
2018-01-20 22:08:46 +00:00
home_message = models.TextField(
verbose_name="Message de la page d'accueil",
default=""
)
2018-03-01 11:02:22 +00:00
site_logo = models.ImageField(
verbose_name="Logo du site",
2018-03-01 11:08:41 +00:00
null=True,
blank=True
2018-03-01 11:02:22 +00:00
)
event_poster = models.ImageField(
verbose_name="Affiche de l'événement",
2018-03-01 11:08:41 +00:00
null=True,
blank=True
2018-03-01 11:02:22 +00:00
)
min_number_of_categories = models.PositiveIntegerField(
verbose_name="Nombre minimal de catégories dans laquelle participer",
default=0,
)
2018-01-20 22:08:46 +00:00
@classmethod
def get_settings(cls):
return cls.objects.get_or_create()[0]