make container and item SoftDeleteModel

This commit is contained in:
j3d1 2023-11-20 12:24:27 +01:00
parent 04581b66b6
commit e2a2e3e117
2 changed files with 35 additions and 2 deletions

View file

@ -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),
),
]

View file

@ -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)