mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
FIX: Legacy Profiles are now auto-approved correctly
This commit is contained in:
@@ -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),
|
||||
),
|
||||
]
|
||||
|
||||
19
RIGS/migrations/0037_auto_20200111_1829.py
Normal file
19
RIGS/migrations/0037_auto_20200111_1829.py
Normal 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)
|
||||
]
|
||||
Reference in New Issue
Block a user