31 lines
971 B
Python
31 lines
971 B
Python
# Generated by Django 2.0 on 2018-03-27 15:54
|
|
|
|
from django.db import migrations, models
|
|
import django.db.models.deletion
|
|
import uuid
|
|
|
|
def gen_unique_keys(apps, schema_editor):
|
|
UserProfile = apps.get_model('events', 'UserProfile')
|
|
for profile in UserProfile.objects.all():
|
|
profile.secret_key = uuid.uuid4()
|
|
profile.save()
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('events', '0020_add_event_comments'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.AddField(
|
|
model_name='userprofile',
|
|
name='secret_key',
|
|
field=models.UUIDField(default=uuid.uuid4),
|
|
),
|
|
migrations.RunPython(gen_unique_keys, reverse_code=migrations.RunPython.noop),
|
|
migrations.AlterField(
|
|
model_name='eventcomment',
|
|
name='event',
|
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='events.Event'),
|
|
),
|
|
]
|