mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
CMULTI is a thing, and therefore a max prefix length of 5 cannot be a thing
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
# Generated by Django 2.0.13 on 2019-12-05 19:37
|
||||
# Generated by Django 2.0.13 on 2019-12-05 20:42
|
||||
|
||||
import re
|
||||
from django.db import migrations, models
|
||||
import django.db.migrations
|
||||
import django.db.migrations.operations.special
|
||||
|
||||
def forwards(apps, schema_editor):
|
||||
AssetModel = apps.get_model('assets', 'Asset')
|
||||
@@ -20,8 +19,15 @@ def forwards(apps, schema_editor):
|
||||
|
||||
row.save(update_fields=['asset_id', 'asset_id_prefix', 'asset_id_number'])
|
||||
|
||||
# Functions from the following migrations need manual copying.
|
||||
# Move them and any dependencies into this file, then update the
|
||||
# RunPython operations to refer to the local versions:
|
||||
# assets.migrations.0008_auto_20191205_1937
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
replaces = [('assets', '0008_auto_20191205_1937'), ('assets', '0009_auto_20191205_2041')]
|
||||
|
||||
dependencies = [
|
||||
('assets', '0007_auto_20190108_0202_squashed_0014_auto_20191017_2052'),
|
||||
]
|
||||
@@ -45,4 +51,14 @@ class Migration(migrations.Migration):
|
||||
name='asset',
|
||||
options={'ordering': ['asset_id_prefix', 'asset_id_number'], 'permissions': (('asset_finance', 'Can see financial data for assets'), ('view_asset', 'Can view an asset'))},
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='asset',
|
||||
name='asset_id',
|
||||
field=models.CharField(max_length=15, unique=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='asset',
|
||||
name='asset_id_prefix',
|
||||
field=models.CharField(default='', max_length=8),
|
||||
),
|
||||
]
|
||||
@@ -64,7 +64,7 @@ class Asset(models.Model):
|
||||
)
|
||||
|
||||
parent = models.ForeignKey(to='self', related_name='asset_parent', blank=True, null=True, on_delete=models.SET_NULL)
|
||||
asset_id = models.CharField(max_length=10, unique=True)
|
||||
asset_id = models.CharField(max_length=15, unique=True)
|
||||
description = models.CharField(max_length=120)
|
||||
category = models.ForeignKey(to=AssetCategory, on_delete=models.CASCADE)
|
||||
status = models.ForeignKey(to=AssetStatus, on_delete=models.CASCADE)
|
||||
@@ -88,7 +88,7 @@ class Asset(models.Model):
|
||||
|
||||
# Hidden asset_id components
|
||||
# For example, if asset_id was "C1001" then asset_id_prefix would be "C" and number "1001"
|
||||
asset_id_prefix = models.CharField(max_length=5, default="")
|
||||
asset_id_prefix = models.CharField(max_length=8, default="")
|
||||
asset_id_number = models.IntegerField(default=1)
|
||||
|
||||
def get_available_asset_id(wanted_prefix=""):
|
||||
|
||||
Reference in New Issue
Block a user