8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-22 11:23:10 +00:00

Ajout des migrations et du champ uuid

This commit is contained in:
Yoann Pétri 2018-07-15 18:34:49 +02:00 committed by root
parent 6b17d924ce
commit 7983b6214a
3 changed files with 57 additions and 0 deletions

View file

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

View file

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

View file

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