Skip to content

Commit

Permalink
add key persons + key sites to case study
Browse files Browse the repository at this point in the history
  • Loading branch information
lukavdplas committed Apr 15, 2024
1 parent 4f1b9d9 commit c50f016
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 3 deletions.
4 changes: 2 additions & 2 deletions backend/case_study/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
@admin.register(models.CaseStudy)
class CaseStudyAdmin(admin.ModelAdmin):
list_display = ["name", "description"]
fields = ["name", "description", "episodes"]
filter_horizontal = ["episodes"]
fields = ["name", "description", "episodes", "key_persons", "key_sites"]
filter_horizontal = ["episodes", "key_persons", "key_sites"]


@admin.register(models.Episode)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Django 4.2.7 on 2024-04-15 12:31

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('person', '0014_alter_persondateofbirth_person_and_more'),
('space', '0008_alter_spacedescription_source'),
('case_study', '0002_casestudy_description_alter_casestudy_name_episode_and_more'),
]

operations = [
migrations.AddField(
model_name='casestudy',
name='key_persons',
field=models.ManyToManyField(blank=True, help_text='Key historical figures involved in this case study', to='person.historicalperson'),
),
migrations.AddField(
model_name='casestudy',
name='key_sites',
field=models.ManyToManyField(blank=True, help_text='Key historical sites involved in this case study', to='space.structure'),
),
]
15 changes: 14 additions & 1 deletion backend/case_study/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from django.db import models
from core.models import Named
from event.models import EventDescription

from person.models import HistoricalPerson
from space.models import Structure

class CaseStudy(Named, models.Model):
"""
Expand All @@ -18,6 +19,18 @@ class Meta:
help_text="Episodes involved in this case study",
)

key_persons = models.ManyToManyField(
to=HistoricalPerson,
blank=True,
help_text="Key historical figures involved in this case study",
)

key_sites = models.ManyToManyField(
to=Structure,
blank=True,
help_text="Key historical sites involved in this case study",
)

def __str__(self):
return self.name

Expand Down

0 comments on commit c50f016

Please sign in to comment.