site_tps/settings/models.py
2018-01-22 21:26:37 +01:00

36 lines
839 B
Python

from django.db import models
from .aes_field import AESEncryptedField
class ContentSettings(models.Model):
ftp_url = models.URLField(
max_length=255,
verbose_name="URL du FTP",
default="",
)
ftp_id = models.CharField(
max_length=255,
verbose_name="Identifiant sur le FTP",
default=""
)
ftp_pass = AESEncryptedField(
max_length=255,
verbose_name="Mot de passe",
default=""
)
class SiteSettings(models.Model):
allow_upload = models.BooleanField(
verbose_name="Autoriser l'upload de vidéos.",
default=False,
)
home_message = models.TextField(
verbose_name="Message de la page d'accueil",
default=""
)
@classmethod
def get_settings(cls):
return cls.objects.get_or_create()[0]