FTP encryption

This commit is contained in:
Klafyvel 2018-01-20 23:08:46 +01:00
parent 5a96b90025
commit afb8d3c0ec
2 changed files with 17 additions and 9 deletions

View file

@ -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]

View file

@ -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': [