1
0
mirror of https://github.com/peeringdb/peeringdb.git synced 2024-05-11 05:55:09 +00:00
Files
peeringdb-peeringdb/peeringdb_server/migrations/0095_emailaddressdata.py
Stefan Pratter 5eb925e319 Support 202301 (#1329)
* fix next redirect when using U2F 2FA auth (#1191)

* Added self identifier to API

* fix migrations hierarchy after merging in previous support branch

* campus object

Co-authored-by: Stefan Pratter <stefan@20c.com>

* fix out of bound error message
add city / country to campus view

* fix tests

* relock poetry

* linting

* linting

* fix docs regen

* regen docs

* linting

* refactor self entity view to support carrier and campus object types and also make it easier to support additional object types in the future

* remove debug message

---------

Co-authored-by: Gajanan Patil <dipaksavaliya.python@gmail.com>
2023-02-15 07:55:01 +00:00

53 lines
1.6 KiB
Python

# Generated by Django 3.2.14 on 2022-08-23 16:05
import django.db.models.deletion
from django.db import migrations, models
from django.utils import timezone
def create_email_address_data(apps, schema_editor):
EmailAddress = apps.get_model("account", "EmailAddress")
EmailAddressData = apps.get_model("peeringdb_server", "EmailAddressData")
now = timezone.now()
for email_address in EmailAddress.objects.filter(verified=True):
EmailAddressData.objects.create(email=email_address, confirmed_date=now)
class Migration(migrations.Migration):
dependencies = [
("account", "0002_email_max_length"),
("peeringdb_server", "0094_auto_20220823_1331"),
]
operations = [
migrations.CreateModel(
name="EmailAddressData",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("confirmed_date", models.DateTimeField(auto_now_add=True)),
(
"email",
models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
related_name="data",
to="account.emailaddress",
),
),
],
options={
"db_table": "peeringdb_email_address_data",
},
),
migrations.RunPython(create_email_address_data, migrations.RunPython.noop),
]