mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
More optimisation and cleanup (#420)
This commit is contained in:
25
assets/migrations/0019_fix_cabletype.py
Normal file
25
assets/migrations/0019_fix_cabletype.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# Generated by Django 3.1.5 on 2021-02-08 16:02
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
def add_default(apps, schema_editor):
|
||||
CableType = apps.get_model('assets', 'CableType')
|
||||
Connector = apps.get_model('assets', 'Connector')
|
||||
for cable_type in CableType.objects.all():
|
||||
if cable_type.plug is None:
|
||||
cable_type.plug = Connector.first()
|
||||
if cable_type.socket is None:
|
||||
cable_type.socket = Connector.first()
|
||||
cable_type.save()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('assets', '0018_auto_20200415_1940'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(add_default, migrations.RunPython.noop)
|
||||
]
|
||||
50
assets/migrations/0020_auto_20210208_1603.py
Normal file
50
assets/migrations/0020_auto_20210208_1603.py
Normal file
@@ -0,0 +1,50 @@
|
||||
# Generated by Django 3.1.5 on 2021-02-08 16:03
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('assets', '0019_fix_cabletype'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='assetstatus',
|
||||
name='display_class',
|
||||
field=models.CharField(blank=True, default='', help_text='HTML class to be appended to alter display of assets with this status, such as in the list.', max_length=80),
|
||||
preserve_default=False,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='cabletype',
|
||||
name='plug',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='plug', to='assets.connector'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='cabletype',
|
||||
name='socket',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='socket', to='assets.connector'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='supplier',
|
||||
name='address',
|
||||
field=models.TextField(blank=True, default=''),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='supplier',
|
||||
name='email',
|
||||
field=models.EmailField(blank=True, default='', max_length=254),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='supplier',
|
||||
name='notes',
|
||||
field=models.TextField(blank=True, default=''),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='supplier',
|
||||
name='phone',
|
||||
field=models.CharField(blank=True, default='', max_length=15),
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user