Update 0046_create_powertests.py

Don't try and find a nonexistent notes field on EventChecklist.
This commit is contained in:
2023-05-19 10:47:50 +00:00
committed by GitHub
parent 01a0b8f831
commit 87aa87bc0f

View File

@@ -10,7 +10,7 @@ def migrate_old_data(apps, schema_editor):
PowerTestRecord = apps.get_model('RIGS', 'PowerTestRecord') PowerTestRecord = apps.get_model('RIGS', 'PowerTestRecord')
for ec in EventChecklist.objects.all(): for ec in EventChecklist.objects.all():
# New highscore for the most pythonic BS I've ever written. # New highscore for the most pythonic BS I've ever written.
PowerTestRecord.objects.create(event=ec.event, **{i.name:getattr(ec, i.attname) for i in PowerTestRecord._meta.get_fields() if not (i.is_relation or i.auto_created)}) PowerTestRecord.objects.create(event=ec.event, **{i.name:getattr(ec, i.attname) for i in PowerTestRecord._meta.get_fields() if not (i.is_relation or i.auto_created or i.name == "notes")})
def revert(apps, schema_editor): def revert(apps, schema_editor):