FIX: Fix missing import

Presumably caused by Matt's IDE being overzealous again. I know I shouldn't be pushing to master but...one line fix...
This commit is contained in:
2019-12-06 00:40:56 +00:00
parent b77615b9b9
commit 602ccc15ea

View File

@@ -1,18 +1,19 @@
# Generated by Django 2.0.13 on 2019-12-05 20:42
import re
from django.db import migrations, models
import django.db.migrations.operations.special
def forwards(apps, schema_editor):
AssetModel = apps.get_model('assets', 'Asset')
for row in AssetModel.objects.all():
row.asset_id = row.asset_id.upper()
asset_search = re.search("^([A-Z0-9]*?[A-Z]?)([0-9]+)$", row.asset_id)
if asset_search is None: # If the asset_id doesn't have a number at the end
row.asset_id += "1"
asset_search = re.search("^([A-Z0-9]*?[A-Z]?)([0-9]+)$", row.asset_id)
row.asset_id_prefix = asset_search.group(1)
row.asset_id_number = int(asset_search.group(2))