created model for shipments

This commit is contained in:
Jan Felix Wiebe 2025-03-15 22:38:56 +01:00
parent 40eae9187b
commit 67075c25b7
6 changed files with 59 additions and 0 deletions

View file

@ -70,6 +70,7 @@ INSTALLED_APPS = [
'inventory',
'mail',
'notify_sessions',
'shipments'
]
REST_FRAMEWORK = {

View file

0
core/shipments/api_v2.py Normal file
View file

View file

@ -0,0 +1,37 @@
# Generated by Django 4.2.7 on 2025-03-15 21:37
from django.db import migrations, models
import django.db.models.manager
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
('inventory', '0007_rename_container_item_container_old_itemplacement_and_more'),
('tickets', '0013_alter_statechange_state'),
]
operations = [
migrations.CreateModel(
name='Shipment',
fields=[
('is_deleted', models.BooleanField(default=False)),
('deleted_at', models.DateTimeField(blank=True, null=True)),
('id', models.AutoField(primary_key=True, serialize=False)),
('public_secret', models.UUIDField(default=uuid.uuid4)),
('created_at', models.DateTimeField(auto_now_add=True, null=True)),
('updated_at', models.DateTimeField(blank=True, null=True)),
('related_items', models.ManyToManyField(to='inventory.item')),
('related_tickets', models.ManyToManyField(to='tickets.issuethread')),
],
options={
'abstract': False,
},
managers=[
('all_objects', django.db.models.manager.Manager()),
],
),
]

View file

21
core/shipments/models.py Normal file
View file

@ -0,0 +1,21 @@
import uuid
from django.db import models
from django_softdelete.models import SoftDeleteModel, SoftDeleteManager
from inventory.models import Item
from tickets.models import IssueThread
class Shipment(SoftDeleteModel):
id = models.AutoField(primary_key=True)
public_secret = models.UUIDField(default = uuid.uuid4)
related_items = models.ManyToManyField(Item)
related_tickets = models.ManyToManyField(IssueThread)
created_at = models.DateTimeField(null=True, auto_now_add=True)
updated_at = models.DateTimeField(blank=True, null=True)
all_objects = models.Manager()
def __str__(self):
return '[' + str(self.id) + ']' + self.description