From 9134f6b95ec4055cccf0988ab9cc563177d36ef9 Mon Sep 17 00:00:00 2001 From: jedi Date: Tue, 19 Nov 2024 23:03:44 +0100 Subject: [PATCH] stash --- ...ontainer_alter_item_event_itemplacement.py | 32 +++++++++++++++++++ ..._alter_itemplacement_container_and_more.py | 29 +++++++++++++++++ core/inventory/models.py | 3 +- core/inventory/serializers.py | 1 - .../0007_alter_eventaddress_address.py | 18 +++++++++++ .../0012_alter_itemrelation_item.py | 20 ++++++++++++ 6 files changed, 101 insertions(+), 2 deletions(-) create mode 100644 core/inventory/migrations/0007_remove_item_container_alter_item_event_itemplacement.py create mode 100644 core/inventory/migrations/0008_alter_item_event_alter_itemplacement_container_and_more.py create mode 100644 core/mail/migrations/0007_alter_eventaddress_address.py create mode 100644 core/tickets/migrations/0012_alter_itemrelation_item.py diff --git a/core/inventory/migrations/0007_remove_item_container_alter_item_event_itemplacement.py b/core/inventory/migrations/0007_remove_item_container_alter_item_event_itemplacement.py new file mode 100644 index 0000000..7ea5d8e --- /dev/null +++ b/core/inventory/migrations/0007_remove_item_container_alter_item_event_itemplacement.py @@ -0,0 +1,32 @@ +# Generated by Django 4.2.7 on 2024-11-20 01:48 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('inventory', '0006_alter_event_table'), + ] + + operations = [ + migrations.RemoveField( + model_name='item', + name='container', + ), + migrations.AlterField( + model_name='item', + name='event', + field=models.ForeignKey(db_column='eid', on_delete=django.db.models.deletion.CASCADE, to='inventory.event'), + ), + migrations.CreateModel( + name='ItemPlacement', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('timestamp', models.DateTimeField(auto_now_add=True)), + ('container', models.ForeignKey(db_column='cid', on_delete=django.db.models.deletion.CASCADE, related_name='item_history', to='inventory.container')), + ('item', models.ForeignKey(db_column='iid', on_delete=django.db.models.deletion.CASCADE, related_name='container_history', to='inventory.item')), + ], + ), + ] diff --git a/core/inventory/migrations/0008_alter_item_event_alter_itemplacement_container_and_more.py b/core/inventory/migrations/0008_alter_item_event_alter_itemplacement_container_and_more.py new file mode 100644 index 0000000..2fae077 --- /dev/null +++ b/core/inventory/migrations/0008_alter_item_event_alter_itemplacement_container_and_more.py @@ -0,0 +1,29 @@ +# Generated by Django 4.2.7 on 2024-11-20 01:52 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('inventory', '0007_remove_item_container_alter_item_event_itemplacement'), + ] + + operations = [ + migrations.AlterField( + model_name='item', + name='event', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='inventory.event'), + ), + migrations.AlterField( + model_name='itemplacement', + name='container', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='item_history', to='inventory.container'), + ), + migrations.AlterField( + model_name='itemplacement', + name='item', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='container_history', to='inventory.item'), + ), + ] diff --git a/core/inventory/models.py b/core/inventory/models.py index fbbe0a9..46a38f0 100644 --- a/core/inventory/models.py +++ b/core/inventory/models.py @@ -1,6 +1,7 @@ from itertools import groupby -from django.db import models +from django.core.files.base import ContentFile +from django.db import models, IntegrityError from django_softdelete.models import SoftDeleteModel, SoftDeleteManager diff --git a/core/inventory/serializers.py b/core/inventory/serializers.py index 210ac0e..79caddd 100644 --- a/core/inventory/serializers.py +++ b/core/inventory/serializers.py @@ -25,7 +25,6 @@ class EventSerializer(serializers.ModelSerializer): dict['addresses'] = [EventAddress.objects.get_or_create(address=x)[0] for x in addresses] return dict - class ContainerSerializer(serializers.ModelSerializer): itemCount = serializers.SerializerMethodField() diff --git a/core/mail/migrations/0007_alter_eventaddress_address.py b/core/mail/migrations/0007_alter_eventaddress_address.py new file mode 100644 index 0000000..7b979a5 --- /dev/null +++ b/core/mail/migrations/0007_alter_eventaddress_address.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.7 on 2024-11-18 01:50 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('mail', '0006_email_raw_file'), + ] + + operations = [ + migrations.AlterField( + model_name='eventaddress', + name='address', + field=models.CharField(max_length=255, unique=True), + ), + ] diff --git a/core/tickets/migrations/0012_alter_itemrelation_item.py b/core/tickets/migrations/0012_alter_itemrelation_item.py new file mode 100644 index 0000000..a8ea2a5 --- /dev/null +++ b/core/tickets/migrations/0012_alter_itemrelation_item.py @@ -0,0 +1,20 @@ +# Generated by Django 4.2.7 on 2024-11-20 01:48 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('inventory', '0007_remove_item_container_alter_item_event_itemplacement'), + ('tickets', '0011_train_old_spam'), + ] + + operations = [ + migrations.AlterField( + model_name='itemrelation', + name='item', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='issue_relations', to='inventory.item'), + ), + ]