Changed settings project name, removed tech db stuff

This commit is contained in:
2025-11-18 23:34:17 +01:00
parent 491afb6257
commit d5befdd018
33 changed files with 6 additions and 785 deletions

2
.vscode/launch.json vendored
View File

@@ -8,7 +8,7 @@
"name": "Python Debugger: Django", "name": "Python Debugger: Django",
"type": "debugpy", "type": "debugpy",
"request": "launch", "request": "launch",
"program": "${workspaceFolder}/techdb/manage.py", "program": "${workspaceFolder}/cntmanage/manage.py",
"args": ["runserver"], "args": ["runserver"],
"console": "integratedTerminal", "console": "integratedTerminal",
"django": true, "django": true,

View File

@@ -1,21 +0,0 @@
from django.contrib import admin
from .models.box import Box, BoxAdmin
from .models.part import Part, PartAdmin
from .models.vendor import Vendor, VendorAdmin
from .models.formone import FormOne,FormOneAdmin
from .models.customer import Customer, CustomerAdmin
from .models.plane import Plane, PlaneAdmin
from .models.workorder import Workorder, WorkorderAdmin
from .models.operator import Operator, OperatorAdmin
from .models.movimag import Movimag, MovimagAdmin
# Register your models here.
admin.site.register(Box, BoxAdmin)
admin.site.register(Part, PartAdmin)
admin.site.register(Vendor, VendorAdmin)
admin.site.register(FormOne,FormOneAdmin)
admin.site.register(Customer, CustomerAdmin)
admin.site.register(Plane, PlaneAdmin)
admin.site.register(Workorder, WorkorderAdmin)
admin.site.register(Operator, OperatorAdmin)
admin.site.register(Movimag, MovimagAdmin)

View File

@@ -1,6 +0,0 @@
from django.apps import AppConfig
class CatopsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'catops'

View File

@@ -1,20 +0,0 @@
# Generated by Django 5.1.2 on 2024-10-18 09:46
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Parts',
fields=[
('id', models.UUIDField(primary_key=True, serialize=False)),
],
),
]

View File

@@ -1,17 +0,0 @@
# Generated by Django 5.1.2 on 2024-10-18 09:55
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('catops', '0001_initial'),
]
operations = [
migrations.RenameModel(
old_name='Parts',
new_name='Part',
),
]

View File

@@ -1,101 +0,0 @@
# Generated by Django 5.1.2 on 2024-10-18 15:45
import django.db.models.deletion
import django.db.models.functions.datetime
import uuid
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('catops', '0002_rename_parts_part'),
]
operations = [
migrations.CreateModel(
name='FormOne',
fields=[
('reg_date', models.DateTimeField(auto_created=True, db_default=django.db.models.functions.datetime.Now(), editable=False)),
('id', models.BigAutoField(primary_key=True, serialize=False)),
('external_id', models.CharField(db_index=True, null=True)),
('doc_path', models.FilePathField(null=True)),
('active', models.BooleanField(db_default=True)),
],
),
migrations.AddField(
model_name='part',
name='active',
field=models.BooleanField(db_default=True),
),
migrations.AddField(
model_name='part',
name='expiry_time',
field=models.DurationField(null=True),
),
migrations.AddField(
model_name='part',
name='last_stock',
field=models.DateField(auto_created=True, db_default=django.db.models.functions.datetime.Now(), editable=False),
),
migrations.AddField(
model_name='part',
name='min_reorder',
field=models.PositiveIntegerField(null=True),
),
migrations.AddField(
model_name='part',
name='part_number',
field=models.CharField(db_index=True, default='aaa', max_length=64, unique=True),
preserve_default=False,
),
migrations.AddField(
model_name='part',
name='properties',
field=models.JSONField(null=True),
),
migrations.AddField(
model_name='part',
name='quantity',
field=models.PositiveIntegerField(default=0),
),
migrations.AddField(
model_name='part',
name='reg_date',
field=models.DateTimeField(auto_created=True, db_default=django.db.models.functions.datetime.Now(), editable=False),
),
migrations.AddField(
model_name='part',
name='serial_number',
field=models.CharField(db_index=True, max_length=64, null=True, unique=True),
),
migrations.AddField(
model_name='part',
name='unit',
field=models.CharField(choices=[('QTY', 'Quantity'), ('LT', 'Liters'), ('USG', 'US Gallons'), ('QTS', 'US Quarters'), ('KG', 'Kilograms'), ('LBS', 'Pounds')], default='QTY'),
),
migrations.AlterField(
model_name='part',
name='id',
field=models.UUIDField(db_index=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False),
),
migrations.CreateModel(
name='Box',
fields=[
('reg_date', models.DateTimeField(auto_created=True, db_default=django.db.models.functions.datetime.Now(), editable=False)),
('id', models.UUIDField(db_index=True, default=uuid.uuid1, editable=False, primary_key=True, serialize=False)),
('loc_room', models.CharField(choices=[('ST1', 'Magazzino'), ('ST2', 'Deposito Esterno')], default='ST1', max_length=3)),
('loc_x', models.CharField(max_length=4)),
('loc_y', models.CharField(max_length=4)),
('loc_z', models.CharField(max_length=4)),
('active', models.BooleanField(db_default=True)),
('label_printed', models.BooleanField(db_default=False)),
('part', models.OneToOneField(null=True, on_delete=django.db.models.deletion.CASCADE, to='catops.part')),
],
),
migrations.AddField(
model_name='part',
name='form_one',
field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='catops.formone'),
),
]

View File

@@ -1,22 +0,0 @@
# Generated by Django 5.1.2 on 2024-10-18 15:45
import django.db.models.functions.datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('catops', '0003_formone_part_active_part_expiry_time_part_last_stock_and_more'),
]
operations = [
migrations.CreateModel(
name='Vendor',
fields=[
('reg_date', models.DateTimeField(auto_created=True, db_default=django.db.models.functions.datetime.Now(), editable=False)),
('id', models.UUIDField(primary_key=True, serialize=False)),
('active', models.BooleanField(db_default=True)),
],
),
]

View File

@@ -1,26 +0,0 @@
# Generated by Django 5.1.2 on 2024-10-18 15:45
import django.db.models.functions.datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('catops', '0004_vendor'),
]
operations = [
migrations.CreateModel(
name='Customer',
fields=[
('reg_date', models.DateTimeField(auto_created=True, db_default=django.db.models.functions.datetime.Now(), editable=False)),
('id', models.BigAutoField(primary_key=True, serialize=False)),
('name', models.CharField(max_length=32)),
('surname', models.CharField(max_length=32)),
('external_id', models.CharField(db_index=True, null=True)),
('properties', models.JSONField(null=True)),
('active', models.BooleanField(db_default=True)),
],
),
]

View File

@@ -1,30 +0,0 @@
# Generated by Django 5.1.2 on 2024-10-18 15:46
import django.db.models.deletion
import django.db.models.functions.datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('catops', '0005_customer'),
]
operations = [
migrations.CreateModel(
name='Plane',
fields=[
('reg_date', models.DateTimeField(auto_created=True, db_default=django.db.models.functions.datetime.Now(), editable=False)),
('id', models.BigAutoField(primary_key=True, serialize=False)),
('tail', models.CharField(max_length=6)),
('manufacturer', models.CharField(max_length=32)),
('model', models.CharField(max_length=32)),
('chassis_num', models.CharField(max_length=32)),
('external_id', models.CharField(db_index=True, null=True)),
('properties', models.JSONField(null=True)),
('active', models.BooleanField(db_default=True)),
('customer', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='catops.customer')),
],
),
]

View File

@@ -1,41 +0,0 @@
# Generated by Django 5.1.2 on 2024-10-18 15:47
import django.db.models.deletion
import django.db.models.functions.datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('catops', '0006_plane'),
]
operations = [
migrations.CreateModel(
name='Operator',
fields=[
('reg_date', models.DateTimeField(auto_created=True, db_default=django.db.models.functions.datetime.Now(), editable=False)),
('id', models.BigAutoField(primary_key=True, serialize=False)),
('name', models.CharField(max_length=32)),
('surname', models.CharField(max_length=32)),
('external_id', models.CharField(db_index=True, null=True)),
('properties', models.JSONField(null=True)),
('active', models.BooleanField(db_default=True)),
],
),
migrations.CreateModel(
name='Workorder',
fields=[
('reg_date', models.DateTimeField(auto_created=True, db_default=django.db.models.functions.datetime.Now(), editable=False)),
('id', models.BigAutoField(primary_key=True, serialize=False)),
('date_begin', models.DateTimeField(db_default=django.db.models.functions.datetime.Now())),
('date_end', models.DateTimeField()),
('external_id', models.CharField(db_index=True, max_length=32, null=True)),
('properties', models.JSONField(null=True)),
('active', models.BooleanField(db_default=True)),
('operator', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='catops.operator')),
('plane', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='catops.plane')),
],
),
]

View File

@@ -1,26 +0,0 @@
# Generated by Django 5.1.2 on 2024-10-18 15:47
import django.db.models.deletion
import django.db.models.functions.datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('catops', '0007_operator_workorder'),
]
operations = [
migrations.CreateModel(
name='Movimag',
fields=[
('mov_datetime', models.DateTimeField(auto_created=True, db_default=django.db.models.functions.datetime.Now(), editable=False)),
('id', models.BigAutoField(primary_key=True, serialize=False)),
('direction', models.CharField(choices=[('LOAD', 'Load'), ('UNLOAD', 'UnLoad')])),
('operator', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='catops.operator')),
('part', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='catops.part')),
('workorder', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='catops.workorder')),
],
),
]

View File

@@ -1,19 +0,0 @@
from django.db import models
from django.utils.translation import gettext_lazy as _
class RoomLocation(models.TextChoices):
STORAGE_1 = "ST1", _("Magazzino")
STORAGE_2 = "ST2", _("Deposito Esterno")
class Units(models.TextChoices):
NUM = "QTY", _("Quantity")
LT = "LT", _("Liters")
USG = "USG", _("US Gallons")
QTS = "QTS", _("US Quarters")
KG = "KG", _("Kilograms")
LBS = "LBS", _("Pounds")
class MoviDirection(models.TextChoices):
LOAD = "LOAD", _("Load")
UNLOAD = "UNLOAD", _("UnLoad")

View File

@@ -1,69 +0,0 @@
import uuid
from django.db import models
from django.contrib import admin
from django.db.models.functions import Now
from .part import Part
from ..misc.units import RoomLocation
# Box identifies a part storage location, it can be a drawer or a bag or a carbord box.
# It has a location and one or multiple parts inside it.
# Properties to visualize the Box model in the Django admin view
class BoxAdmin(admin.ModelAdmin):
list_display = ("id", "loc_room", "loc_x", "loc_y", "loc_z", "reg_date", "active")
list_filter = ["loc_room"]
class Box(models.Model):
id = models.UUIDField(
primary_key=True,
default=uuid.uuid1,
db_index=True,
editable=False,
serialize=str,
)
reg_date = models.DateTimeField(
auto_created=True,
editable=False,
db_default=Now(),
)
loc_room = models.CharField(
max_length=3,
choices=RoomLocation,
default=RoomLocation.STORAGE_1,
null=False,
)
loc_x = models.CharField(
max_length=4,
)
loc_y = models.CharField(
max_length=4,
)
loc_z = models.CharField(
max_length=4,
)
active = models.BooleanField(
db_default=True
)
label_printed = models.BooleanField(
db_default=False,
)
part = models.OneToOneField(
Part,
unique=True,
db_index=True,
swappable=True,
null=True,
on_delete=models.CASCADE,
)
def __str__(self):
return f"{str(self.id)}"

View File

@@ -1,39 +0,0 @@
from django.db import models
from django.contrib import admin
from django.db.models.functions import Now
class CustomerAdmin(admin.ModelAdmin):
list_display = ()
list_filter = []
class Customer(models.Model):
id = models.BigAutoField(
primary_key=True
)
reg_date = models.DateTimeField(
auto_created=True,
editable=False,
db_default=Now()
)
name = models.CharField(
max_length=32
)
surname = models.CharField(
max_length=32
)
external_id = models.CharField(
db_index=True,
null=True,
)
properties = models.JSONField(
null=True
)
active = models.BooleanField(
db_default=True
)

View File

@@ -1,31 +0,0 @@
from django.db import models
from django.contrib import admin
from django.db.models.functions import Now
class FormOneAdmin(admin.ModelAdmin):
list_display = ()
list_filter = []
class FormOne(models.Model):
id = models.BigAutoField(
primary_key=True
)
reg_date = models.DateTimeField(
auto_created=True,
editable=False,
db_default=Now()
)
external_id = models.CharField(
db_index=True,
null=True,
)
doc_path = models.FilePathField(
null=True
)
active = models.BooleanField(
db_default=True
)

View File

@@ -1,43 +0,0 @@
from django.db import models
from django.contrib import admin
from django.db.models.functions import Now
from .part import Part
from .operator import Operator
from .workorder import Workorder
from ..misc import units
class MovimagAdmin(admin.ModelAdmin):
list_display = ()
list_filter = []
class Movimag(models.Model):
id = models.BigAutoField(
primary_key=True
)
mov_datetime = models.DateTimeField(
auto_created=True,
editable=False,
db_default=Now()
)
part = models.ForeignKey(
Part,
on_delete=models.DO_NOTHING
)
workorder = models.ForeignKey(
Workorder,
on_delete=models.DO_NOTHING
)
operator = models.ForeignKey(
Operator,
on_delete=models.DO_NOTHING
)
direction = models.CharField(
null=False,
choices=units.MoviDirection
)

View File

@@ -1,39 +0,0 @@
from django.db import models
from django.contrib import admin
from django.db.models.functions import Now
class OperatorAdmin(admin.ModelAdmin):
list_display = ()
list_filter = ()
class Operator(models.Model):
id = models.BigAutoField(
primary_key=True
)
reg_date = models.DateTimeField(
auto_created=True,
editable=False,
db_default=Now()
)
name = models.CharField(
max_length=32
)
surname = models.CharField(
max_length=32
)
external_id = models.CharField(
db_index=True,
null=True,
)
properties = models.JSONField(
null=True
)
active = models.BooleanField(
db_default=True
)

View File

@@ -1,87 +0,0 @@
import uuid
from django.db import models
from django.contrib import admin
from django.db.models.functions import Now
from django.utils.translation import gettext_lazy as _
from ..misc.units import Units
from .formone import FormOne
# Part identifies a part with its part number and associated properties:
# such as torage quantity, min reorder quantities and expiry date.
class PartAdmin(admin.ModelAdmin):
list_display = ()
list_filter = ()
class Part(models.Model):
id = models.UUIDField(
primary_key=True,
default=uuid.uuid4,
db_index=True,
editable=False,
serialize=str
)
reg_date = models.DateTimeField(
auto_created=True,
editable=False,
db_default=Now()
)
part_number = models.CharField(
db_index=True,
max_length=64,
null=False,
unique=True
)
serial_number = models.CharField(
db_index=True,
max_length=64,
null=True,
unique=True
)
quantity = models.PositiveIntegerField(
null=False,
default=0
)
unit = models.CharField(
choices=Units,
default=Units.NUM,
null=False
)
last_stock = models.DateField(
null=False,
auto_created=True,
editable=False,
db_default=Now()
)
expiry_time = models.DurationField(
null=True,
)
min_reorder = models.PositiveIntegerField(
null=True
)
properties = models.JSONField(
null=True
)
form_one = models.OneToOneField(
FormOne,
on_delete=models.DO_NOTHING,
db_index=True,
unique=True,
null=True
)
active = models.BooleanField(
db_default=True
)

View File

@@ -1,59 +0,0 @@
from django.db import models
from django.contrib import admin
from django.db.models.functions import Now
from .customer import Customer
class PlaneAdmin(admin.ModelAdmin):
list_display = ()
list_filter = []
class Plane(models.Model):
id = models.BigAutoField(
primary_key=True
)
reg_date = models.DateTimeField(
auto_created=True,
editable=False,
db_default=Now()
)
tail = models.CharField(
max_length=6,
null=False
)
manufacturer = models.CharField(
max_length=32,
null=False
)
model = models.CharField(
max_length=32,
null=False
)
chassis_num = models.CharField(
max_length=32,
null=False
)
external_id = models.CharField(
db_index=True,
null=True,
)
customer = models.ForeignKey(
Customer,
on_delete=models.DO_NOTHING
)
properties = models.JSONField(
null=True
)
active = models.BooleanField(
db_default=True
)

View File

@@ -1,23 +0,0 @@
import uuid
from django.db import models
from django.contrib import admin
from django.db.models.functions import Now
class VendorAdmin(admin.ModelAdmin):
list_display = ()
list_filter = ()
class Vendor(models.Model):
id = models.UUIDField(primary_key=True)
reg_date = models.DateTimeField(
auto_created=True,
editable=False,
db_default=Now()
)
active = models.BooleanField(
db_default=True
)

View File

@@ -1,54 +0,0 @@
from django.db import models
from django.contrib import admin
from django.db.models.functions import Now
from .plane import Plane
from .operator import Operator
class WorkorderAdmin(admin.ModelAdmin):
list_display = ()
list_filter = []
class Workorder(models.Model):
id = models.BigAutoField(
primary_key=True
)
reg_date = models.DateTimeField(
auto_created=True,
editable=False,
db_default=Now()
)
date_begin = models.DateTimeField(
null=False,
db_default=Now()
)
date_end = models.DateTimeField(
null=False
)
external_id = models.CharField(
max_length=32,
db_index=True,
null=True,
)
plane = models.ForeignKey(
Plane,
on_delete=models.DO_NOTHING
)
operator = models.ForeignKey(
Operator,
on_delete=models.DO_NOTHING
)
properties = models.JSONField(
null=True
)
active = models.BooleanField(
db_default=True
)

View File

@@ -1,3 +0,0 @@
from django.test import TestCase
# Create your tests here.

View File

@@ -1,3 +0,0 @@
from django.shortcuts import render
# Create your views here.

View File

@@ -11,6 +11,6 @@ import os
from django.core.asgi import get_asgi_application from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'techdb.settings') os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'cntmanage.settings')
application = get_asgi_application() application = get_asgi_application()

View File

@@ -62,7 +62,7 @@ MIDDLEWARE = [
'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware',
] ]
ROOT_URLCONF = 'techdb.urls' ROOT_URLCONF = 'cntmanage.urls'
TEMPLATES = [ TEMPLATES = [
{ {
@@ -80,7 +80,7 @@ TEMPLATES = [
}, },
] ]
WSGI_APPLICATION = 'techdb.wsgi.application' WSGI_APPLICATION = 'cntmanage.wsgi.application'
STATICFILES_DIRS = [ STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static"), os.path.join(BASE_DIR, "static"),

View File

@@ -11,6 +11,6 @@ import os
from django.core.wsgi import get_wsgi_application from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'techdb.settings') os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'cntmanage.settings')
application = get_wsgi_application() application = get_wsgi_application()

View File

@@ -6,7 +6,7 @@ import sys
def main(): def main():
"""Run administrative tasks.""" """Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'techdb.settings') os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'cntmanage.settings')
try: try:
from django.core.management import execute_from_command_line from django.core.management import execute_from_command_line
except ImportError as exc: except ImportError as exc: