created model for shipments
This commit is contained in:
parent
40eae9187b
commit
67075c25b7
6 changed files with 59 additions and 0 deletions
|
@ -70,6 +70,7 @@ INSTALLED_APPS = [
|
||||||
'inventory',
|
'inventory',
|
||||||
'mail',
|
'mail',
|
||||||
'notify_sessions',
|
'notify_sessions',
|
||||||
|
'shipments'
|
||||||
]
|
]
|
||||||
|
|
||||||
REST_FRAMEWORK = {
|
REST_FRAMEWORK = {
|
||||||
|
|
0
core/shipments/__init__.py
Normal file
0
core/shipments/__init__.py
Normal file
0
core/shipments/api_v2.py
Normal file
0
core/shipments/api_v2.py
Normal file
37
core/shipments/migrations/0001_initial.py
Normal file
37
core/shipments/migrations/0001_initial.py
Normal 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()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
0
core/shipments/migrations/__init__.py
Normal file
0
core/shipments/migrations/__init__.py
Normal file
21
core/shipments/models.py
Normal file
21
core/shipments/models.py
Normal 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
|
Loading…
Add table
Reference in a new issue