8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-18 13:03:46 +00:00
re2o/users/migrations/0085_user_email_state.py

30 lines
874 B
Python
Raw Permalink Normal View History

# -*- coding: utf-8 -*-
# Generated by Django 1.11.28 on 2020-04-16 22:31
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0084_auto_20191120_0159'),
]
2020-04-17 15:37:47 +00:00
def flag_verified(apps, schema_editor):
db_alias = schema_editor.connection.alias
users = apps.get_model("users", "User")
users.objects.using(db_alias).all().update(email_state=0)
2020-04-17 15:42:23 +00:00
def undo_flag_verified(apps, schema_editor):
return
operations = [
migrations.AddField(
model_name='user',
name='email_state',
field=models.IntegerField(choices=[(0, 'Verified'), (1, 'Unverified'), (2, 'Waiting for email confirmation')], default=2),
),
2020-04-17 15:42:23 +00:00
migrations.RunPython(flag_verified, undo_flag_verified),
]