FIX: Legacy Profiles are now auto-approved correctly

This commit is contained in:
2020-01-11 18:33:11 +00:00
parent d06273c215
commit 7458b56138
2 changed files with 20 additions and 2 deletions

View File

@@ -13,7 +13,6 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='profile',
name='is_approved',
# Approve existing profiles automatically, new ones default false.
field=models.BooleanField(default=True),
field=models.BooleanField(default=False),
),
]

View File

@@ -0,0 +1,19 @@
# Generated by Django 2.0.13 on 2020-01-11 18:29
# This migration ensures that legacy Profiles from before approvals were implemented are automatically approved
from django.db import migrations
def approve_legacy(apps, schema_editor):
Profile = apps.get_model('RIGS', 'Profile')
for person in Profile.objects.all():
person.is_approved = True
person.save()
class Migration(migrations.Migration):
dependencies = [
('RIGS', '0036_profile_is_approved'),
]
operations = [
migrations.RunPython(approve_legacy)
]