Skip to content

Commit

Permalink
feat(models): add exile data
Browse files Browse the repository at this point in the history
  • Loading branch information
b1rger committed Feb 12, 2025
1 parent 76628fa commit 9f5a8b9
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
34 changes: 34 additions & 0 deletions apis_instance_nsvis/migrations/0028_exilein.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Generated by Django 5.1.2 on 2025-02-11 12:46

import django.db.models.deletion
import django_interval.fields
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('apis_instance_nsvis', '0027_person_propaganda_membership_person_work_ban_and_more'),
('relations', '0001_initial'),
]

operations = [
migrations.CreateModel(
name='ExileIn',
fields=[
('relation_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='relations.relation')),
('from_date', django_interval.fields.FuzzyDateParserField(blank=True, null=True)),
('to_date', django_interval.fields.FuzzyDateParserField(blank=True, null=True)),
('from_date_date_sort', models.DateField(blank=True, editable=False, null=True)),
('from_date_date_from', models.DateField(blank=True, editable=False, null=True)),
('from_date_date_to', models.DateField(blank=True, editable=False, null=True)),
('to_date_date_sort', models.DateField(blank=True, editable=False, null=True)),
('to_date_date_from', models.DateField(blank=True, editable=False, null=True)),
('to_date_date_to', models.DateField(blank=True, editable=False, null=True)),
],
options={
'abstract': False,
},
bases=('relations.relation', models.Model),
),
]
13 changes: 13 additions & 0 deletions apis_instance_nsvis/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,19 @@ def reverse_name(self) -> str:
return _("is place of death of")


class ExileIn(TimespanMixin, Relation):
subj_model = Person
obj_model = Place

@classmethod
def name(self) -> str:
return _("was in exile in")

@classmethod
def reverse_name(self) -> str:
return _("was place of exile for")


auditlog.register(CollaboratesWith)
auditlog.register(IsMemberOf)
auditlog.register(IsInventoriedIn)
Expand Down
4 changes: 4 additions & 0 deletions apis_instance_nsvis/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ class PersonProfessionTypeRelationsTable(TimespanTable):
class Meta(TimespanTable.Meta):
sequence = (list(TimespanTable.Meta.sequence)[:-5] + ["details"] + list(TimespanTable.Meta.sequence)[-5:])


class PersonPlaceRelationsTable(TimespanTable):
class Meta(TimespanTable.Meta):
...

0 comments on commit 9f5a8b9

Please sign in to comment.