Coverage for apis_core/relations/abc.py: 0%

58 statements  

« prev     ^ index     » next       coverage.py v7.5.3, created at 2025-06-25 10:00 +0000

1from django.utils.translation import gettext_lazy as _ 

2 

3from apis_core.apis_entities.abc import E21_Person, E53_Place, E74_Group 

4from apis_core.relations.models import Relation 

5 

6 

7class IsMemberOf(Relation): 

8 subj_model = E21_Person 

9 obj_model = E74_Group 

10 

11 class Meta: 

12 abstract = True 

13 

14 @classmethod 

15 def name(self) -> str: 

16 return _("is member of") 

17 

18 @classmethod 

19 def reverse_name(self) -> str: 

20 return _("has as member") 

21 

22 

23class LivesIn(Relation): 

24 subj_model = E21_Person 

25 obj_model = E53_Place 

26 

27 class Meta: 

28 abstract = True 

29 

30 @classmethod 

31 def name(self) -> str: 

32 return _("lives in") 

33 

34 @classmethod 

35 def reverse_name(self) -> str: 

36 return _("has habitant") 

37 

38 

39class IsLocatedIn(Relation): 

40 subj_model = E53_Place 

41 obj_model = E53_Place 

42 

43 class Meta: 

44 abstract = True 

45 

46 @classmethod 

47 def name(self) -> str: 

48 return _("is located in") 

49 

50 @classmethod 

51 def reverse_name(self) -> str: 

52 return _("is location of") 

53 

54 

55class BornIn(Relation): 

56 subj_model = E21_Person 

57 obj_model = E53_Place 

58 

59 class Meta: 

60 abstract = True 

61 

62 @classmethod 

63 def name(self) -> str: 

64 return _("born in") 

65 

66 @classmethod 

67 def reverse_name(self) -> str: 

68 return _("is birth place of") 

69 

70 

71class DiedIn(Relation): 

72 subj_model = E21_Person 

73 obj_model = E53_Place 

74 

75 class Meta: 

76 abstract = True 

77 

78 @classmethod 

79 def name(self) -> str: 

80 return _("died in") 

81 

82 @classmethod 

83 def reverse_name(self) -> str: 

84 return _("is place of death of")