ConceptPortal-public/rsconcept/backend/apps/rsform/models/Attribution.py
Ivan 15b4298b22
Some checks failed
Backend CI / build (3.12) (push) Has been cancelled
Frontend CI / build (22.x) (push) Has been cancelled
Backend CI / notify-failure (push) Has been cancelled
Frontend CI / notify-failure (push) Has been cancelled
F: Rename Nominal relation and improve UI
2025-08-21 21:28:14 +03:00

29 lines
966 B
Python

''' Models: Attribution of nominal constituents. '''
from django.db.models import CASCADE, ForeignKey, Model
class Attribution(Model):
''' Attribution links nominal constituent to its content.'''
container = ForeignKey(
verbose_name='Составная конституента',
to='rsform.Constituenta',
on_delete=CASCADE,
related_name='as_container'
)
attribute = ForeignKey(
verbose_name='Атрибутирующая конституента',
to='rsform.Constituenta',
on_delete=CASCADE,
related_name='as_attribute'
)
class Meta:
''' Model metadata. '''
verbose_name = 'Атрибутирование конституент'
verbose_name_plural = 'Атрибутирования конституент'
unique_together = [['container', 'attribute']]
def __str__(self) -> str:
return f'{self.container} -> {self.attribute}'