make tickets assignable to users

This commit is contained in:
j3d1 2024-01-22 17:21:22 +01:00
parent 4be8109753
commit e605292bf0
11 changed files with 317 additions and 110 deletions

View file

@ -8,7 +8,6 @@ class ItemManager(SoftDeleteManager):
def create(self, **kwargs):
if 'uid' in kwargs:
raise ValueError('uid must not be set manually')
#uid = Item.objects.filter(event=kwargs['event']).count() + 1
uid = Item.all_objects.filter(event=kwargs['event']).count() + 1
kwargs['uid'] = uid
return super().create(**kwargs)
@ -24,7 +23,7 @@ class Item(SoftDeleteModel):
event = models.ForeignKey('Event', models.CASCADE, db_column='eid')
container = models.ForeignKey('Container', models.CASCADE, db_column='cid')
returned_at = models.DateTimeField(blank=True, null=True)
created_at = models.DateTimeField(blank=True, null=True)
created_at = models.DateTimeField(null=True, auto_now_add=True)
updated_at = models.DateTimeField(blank=True, null=True)
objects = ItemManager()
@ -36,6 +35,7 @@ class Item(SoftDeleteModel):
('match_item', 'Can match item')
]
class Container(SoftDeleteModel):
cid = models.AutoField(primary_key=True)
name = models.CharField(max_length=255)
@ -51,5 +51,5 @@ class Event(models.Model):
end = models.DateTimeField(blank=True, null=True)
pre_start = models.DateTimeField(blank=True, null=True)
post_end = models.DateTimeField(blank=True, null=True)
created_at = models.DateTimeField(blank=True, null=True)
created_at = models.DateTimeField(null=True, auto_now_add=True)
updated_at = models.DateTimeField(blank=True, null=True)