From 7983b6214aba1d8bd63cda45ee2c712d3b6bc8f3 Mon Sep 17 00:00:00 2001 From: Yoann Pietri Date: Sun, 15 Jul 2018 18:34:49 +0200 Subject: [PATCH] Ajout des migrations et du champ uuid --- .../migrations/0035_auto_20180715_1637.py | 25 +++++++++++++++ users/migrations/0073_auto_20180715_1647.py | 31 +++++++++++++++++++ users/models.py | 1 + 3 files changed, 57 insertions(+) create mode 100644 preferences/migrations/0035_auto_20180715_1637.py create mode 100644 users/migrations/0073_auto_20180715_1647.py diff --git a/preferences/migrations/0035_auto_20180715_1637.py b/preferences/migrations/0035_auto_20180715_1637.py new file mode 100644 index 00000000..5c0a3cb1 --- /dev/null +++ b/preferences/migrations/0035_auto_20180715_1637.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.7 on 2018-07-15 14:37 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('preferences', '0034_auto_20180416_1120'), + ] + + operations = [ + migrations.AddField( + model_name='optionaluser', + name='mail_verification', + field=models.BooleanField(default=True, help_text='Vérification du mail obligatoire'), + ), + migrations.AddField( + model_name='optionaluser', + name='verification_time', + field=models.PositiveIntegerField(blank=True, help_text='Durée (en heures) pour vérifier son compte (laisser vide pour ne pas avoir de limite', null=True), + ), + ] diff --git a/users/migrations/0073_auto_20180715_1647.py b/users/migrations/0073_auto_20180715_1647.py new file mode 100644 index 00000000..9701220e --- /dev/null +++ b/users/migrations/0073_auto_20180715_1647.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.7 on 2018-07-15 14:47 +from __future__ import unicode_literals + +from django.db import migrations, models + +def update(apps, schema_editor): + User = apps.get_model('users', 'User') + for u in User.objects.all(): + u.verified = True + u.save() + +class Migration(migrations.Migration): + + dependencies = [ + ('users', '0072_auto_20180426_2021'), + ] + + operations = [ + migrations.AddField( + model_name='user', + name='verification_deadline', + field=models.DateTimeField(blank=True, null=True), + ), + migrations.AddField( + model_name='user', + name='verified', + field=models.BooleanField(default=False), + ), + migrations.RunPython(update) + ] diff --git a/users/models.py b/users/models.py index ae7dd4d1..e885ab83 100644 --- a/users/models.py +++ b/users/models.py @@ -232,6 +232,7 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser, blank=True, null = True ) + verification_uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) USERNAME_FIELD = 'pseudo' REQUIRED_FIELDS = ['surname', 'email']