From e2a2e3e117983400488a618da60e676c593c6a50 Mon Sep 17 00:00:00 2001 From: jedi Date: Mon, 20 Nov 2023 12:24:27 +0100 Subject: [PATCH] make container and item SoftDeleteModel --- ...eleted_at_container_is_deleted_and_more.py | 33 +++++++++++++++++++ core/inventory/models.py | 4 +-- 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 core/inventory/migrations/0002_container_deleted_at_container_is_deleted_and_more.py diff --git a/core/inventory/migrations/0002_container_deleted_at_container_is_deleted_and_more.py b/core/inventory/migrations/0002_container_deleted_at_container_is_deleted_and_more.py new file mode 100644 index 0000000..28523a7 --- /dev/null +++ b/core/inventory/migrations/0002_container_deleted_at_container_is_deleted_and_more.py @@ -0,0 +1,33 @@ +# Generated by Django 4.2.7 on 2023-11-20 11:23 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('inventory', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='container', + name='deleted_at', + field=models.DateTimeField(blank=True, null=True), + ), + migrations.AddField( + model_name='container', + name='is_deleted', + field=models.BooleanField(default=False), + ), + migrations.AddField( + model_name='item', + name='deleted_at', + field=models.DateTimeField(blank=True, null=True), + ), + migrations.AddField( + model_name='item', + name='is_deleted', + field=models.BooleanField(default=False), + ), + ] diff --git a/core/inventory/models.py b/core/inventory/models.py index b4630d2..85eee8a 100644 --- a/core/inventory/models.py +++ b/core/inventory/models.py @@ -13,7 +13,7 @@ class ItemManager(models.Manager): return super().create(**kwargs) -class Item(models.Model): +class Item(SoftDeleteModel): iid = models.AutoField(primary_key=True) uid = models.IntegerField() description = models.TextField() @@ -29,7 +29,7 @@ class Item(models.Model): unique_together = (('uid', 'event'),) -class Container(models.Model): +class Container(SoftDeleteModel): cid = models.AutoField(primary_key=True) name = models.CharField(max_length=255) created_at = models.DateTimeField(blank=True, null=True)