mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-26 01:42:16 +00:00
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:
@@ -1,18 +1,19 @@
|
|||||||
# Generated by Django 2.0.13 on 2019-12-05 20:42
|
# Generated by Django 2.0.13 on 2019-12-05 20:42
|
||||||
|
|
||||||
|
import re
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.migrations.operations.special
|
import django.db.migrations.operations.special
|
||||||
|
|
||||||
def forwards(apps, schema_editor):
|
def forwards(apps, schema_editor):
|
||||||
AssetModel = apps.get_model('assets', 'Asset')
|
AssetModel = apps.get_model('assets', 'Asset')
|
||||||
|
|
||||||
for row in AssetModel.objects.all():
|
for row in AssetModel.objects.all():
|
||||||
|
|
||||||
row.asset_id = row.asset_id.upper()
|
row.asset_id = row.asset_id.upper()
|
||||||
asset_search = re.search("^([A-Z0-9]*?[A-Z]?)([0-9]+)$", row.asset_id)
|
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
|
if asset_search is None: # If the asset_id doesn't have a number at the end
|
||||||
row.asset_id += "1"
|
row.asset_id += "1"
|
||||||
|
|
||||||
asset_search = re.search("^([A-Z0-9]*?[A-Z]?)([0-9]+)$", row.asset_id)
|
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_prefix = asset_search.group(1)
|
||||||
row.asset_id_number = int(asset_search.group(2))
|
row.asset_id_number = int(asset_search.group(2))
|
||||||
|
|||||||
Reference in New Issue
Block a user