Coverage for sample_project / models.py: 98%
47 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-05-05 11:37 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-05-05 11:37 +0000
1from django.db import models
3from apis_core.apis_entities.abc import E21_Person, E53_Place, E74_Group
4from apis_core.apis_entities.models import AbstractEntity
5from apis_core.entities.abc import Entity
6from apis_core.generic.abc import GenericModel
7from apis_core.history.models import VersionMixin
8from apis_core.relations.models import Relation
11class Profession(VersionMixin, GenericModel, models.Model):
12 name = models.CharField(blank=True, default="", max_length=1024)
14 def __str__(self):
15 return self.name
18class Person(E21_Person, VersionMixin, AbstractEntity, Entity):
19 profession = models.ManyToManyField(Profession, blank=True)
22class Place(E53_Place, VersionMixin, AbstractEntity, Entity):
23 pass
26class Group(E74_Group, VersionMixin, AbstractEntity, Entity):
27 pass
30class IsCousinOf(Relation):
31 subj_model = Person
32 obj_model = Person
34 @classmethod
35 def reverse_name(self) -> str:
36 return "is cousin of"
39class IsPartOf(Relation):
40 subj_model = Person
41 obj_model = Group
43 @classmethod
44 def reverse_name(self) -> str:
45 return "consists of"
48class IsSiblingOf(Relation):
49 subj_model = Person
50 obj_model = Person
52 @classmethod
53 def reverse_name(self) -> str:
54 return "is sibling of"
57class LivesIn(Relation):
58 subj_model = Person
59 obj_model = Place
61 @classmethod
62 def reverse_name(self) -> str:
63 return "has inhabitant"
66class IsParentOf(Relation):
67 subj_model = Person
68 obj_model = Person
70 @classmethod
71 def reverse_name(self) -> str:
72 return "is child of"