From afb8d3c0ecd9d08235c5e70fba3bc9c49411f94d Mon Sep 17 00:00:00 2001 From: Klafyvel Date: Sat, 20 Jan 2018 23:08:46 +0100 Subject: [PATCH] FTP encryption --- settings/models.py | 24 ++++++++++++++++-------- site_tps/settings.py | 2 +- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/settings/models.py b/settings/models.py index 2575479..b4a4ddd 100644 --- a/settings/models.py +++ b/settings/models.py @@ -1,6 +1,6 @@ from django.db import models import binascii -import site_tps.qaes +from site_tps import qaes from django.conf import settings @@ -17,23 +17,31 @@ class AESEncryptedField(models.CharField): class ContentSettings(models.Model): ftp_url = models.URLField( max_length=255, - name="URL du FTP", + verbose_name="URL du FTP", + default="", ) ftp_id = models.CharField( max_length=255, - name="Identifiant sur le FTP", + verbose_name="Identifiant sur le FTP", + default="" ) ftp_pass = AESEncryptedField( max_length=255, - name="Mot de passe" + verbose_name="Mot de passe", + default="" ) class SiteSettings(models.Model): allow_upload = models.BooleanField( - help_text="Autoriser l'upload de vidéos." + verbose_name="Autoriser l'upload de vidéos.", + default=False, ) - site_name = models.CharField( - max_length=255, - help_text="Nom du site", + 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] diff --git a/site_tps/settings.py b/site_tps/settings.py index 3b190e8..ab16df0 100644 --- a/site_tps/settings.py +++ b/site_tps/settings.py @@ -56,7 +56,7 @@ ROOT_URLCONF = 'site_tps.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [], + 'DIRS': [os.path.join(BASE_DIR, 'templates')], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [