feat(itim): Porte Notes Model

ref: #526 #536
This commit is contained in:
2025-02-07 20:34:48 +09:30
parent a161677f79
commit 39fdc9ef1d
2 changed files with 74 additions and 0 deletions

View File

@ -0,0 +1,29 @@
# Generated by Django 5.1.5 on 2025-02-07 11:04
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0015_manufacturernotes'),
('itim', '0009_clustertypenotes'),
]
operations = [
migrations.CreateModel(
name='PortNotes',
fields=[
('modelnotes_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.modelnotes')),
('model', models.ForeignKey(help_text='Model this note belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='notes', to='itim.port', verbose_name='Model')),
],
options={
'verbose_name': 'Port Note',
'verbose_name_plural': 'Port Notes',
'db_table': 'itim_port_notes',
'ordering': ['-created'],
},
bases=('core.modelnotes',),
),
]

View File

@ -0,0 +1,45 @@
from access.fields import *
from core.models.model_notes import ModelNotes
from itim.models.services import Port
class PortNotes(
ModelNotes
):
class Meta:
db_table = 'itim_port_notes'
ordering = ModelNotes._meta.ordering
verbose_name = 'Port Note'
verbose_name_plural = 'Port Notes'
model = models.ForeignKey(
Port,
blank = False,
help_text = 'Model this note belongs to',
null = False,
on_delete = models.CASCADE,
related_name = 'notes',
verbose_name = 'Model',
)
table_fields: list = []
page_layout: dict = []
def get_url_kwargs(self) -> dict:
return {
'model_id': self.model.pk,
'pk': self.pk
}