ConceptPortal-public/rsconcept/backend/apps/oss/models/Inheritance.py

35 lines
1.1 KiB
Python
Raw Normal View History

''' Models: Synthesis Inheritance. '''
from django.db.models import CASCADE, ForeignKey, Model
class Inheritance(Model):
''' Inheritance links parent and child constituents in synthesis operation.'''
2024-08-02 11:17:14 +03:00
operation: ForeignKey = ForeignKey(
verbose_name='Операция',
to='oss.Operation',
on_delete=CASCADE,
related_name='inheritances'
)
parent: ForeignKey = ForeignKey(
verbose_name='Исходная конституента',
to='rsform.Constituenta',
on_delete=CASCADE,
related_name='as_parent'
)
child: ForeignKey = ForeignKey(
verbose_name='Наследованная конституента',
to='rsform.Constituenta',
on_delete=CASCADE,
related_name='as_child'
)
class Meta:
''' Model metadata. '''
verbose_name = 'Наследование синтеза'
verbose_name_plural = 'Отношение наследования конституент'
2024-07-25 21:19:15 +03:00
unique_together = [['parent', 'child']]
def __str__(self) -> str:
return f'{self.parent} -> {self.child}'