Skip to content

Commit

Permalink
Merge branch 'release/0.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
lukavdplas committed Apr 24, 2024
2 parents fc4b6c1 + f102f67 commit 5a73ecb
Show file tree
Hide file tree
Showing 54 changed files with 2,448 additions and 1,283 deletions.
26 changes: 23 additions & 3 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,29 @@ message: >-
metadata from this file.
type: software
authors:
- name: 'Research Software Lab, Centre for Digital Humanities, Utrecht University'
- given-names: Robert
family-names: Flierman
email: [email protected]
affiliation: >-
Departement Talen, Literatuur en Communicatie Keltisch
en Klassieken, Utrecht University
orcid: 'https://orcid.org/0000-0002-6480-2462'
- given-names: Hope
family-names: Williard
email: [email protected]
affiliation: >-
Departement Talen, Literatuur en Communicatie Keltisch
en Klassieken, Utrecht University
orcid: 'https://orcid.org/0000-0001-6249-7591'
- given-names: Anne
family-names: Sieberichs
email: [email protected]
affiliation: 'Departement Talen, Literatuur en Communicatie'
- name: >-
Research Software Lab, Centre for Digital Humanities,
Utrecht University
website: 'https://cdh.uu.nl/rsl/'
repository-code: 'https://github.com/CentreForDigitalHumanities/lettercraft'
license: BSD-3-Clause
version: 0.2.0
date-released: '2024-03-13'
version: 0.3.0
date-released: '2024-04-24'
7 changes: 3 additions & 4 deletions backend/case_study/admin.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from django.contrib import admin
from . import models
from event.admin import EpistolaryEventInline


@admin.register(models.CaseStudy)
class CaseStudyAdmin(admin.ModelAdmin):
fields = ["name"]
inlines = [EpistolaryEventInline]
extra = 0
list_display = ["name", "description"]
fields = ["name", "description", "episodes", "key_persons", "key_sites"]
filter_horizontal = ["episodes", "key_persons", "key_sites"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Generated by Django 4.2.7 on 2024-04-11 13:14

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("event", "0015_alter_eventcategory_options_episode"),
("case_study", "0001_initial"),
]

operations = [
migrations.AddField(
model_name="casestudy",
name="description",
field=models.TextField(
blank=True, help_text="Longer description to help identify this object"
),
),
migrations.AlterField(
model_name="casestudy",
name="name",
field=models.CharField(
help_text="A name to help identify this object", max_length=200
),
),
migrations.AddField(
model_name="casestudy",
name="episodes",
field=models.ManyToManyField(
blank=True,
help_text="Episodes involved in this case study",
to="event.episode",
),
),
]
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'),
),
]
27 changes: 21 additions & 6 deletions backend/case_study/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
from django.db import models
from core.models import Named
from event.models import Episode
from person.models import HistoricalPerson
from space.models import Structure


class CaseStudy(models.Model):
class CaseStudy(Named, models.Model):
"""
A case study is an overarching collection of epistolary events, bound together by a common theme, e.g. `The Saga of St. Boniface` or `The Nun Rebellion of Poitiers`.
"""
Expand All @@ -10,10 +13,22 @@ class Meta:
verbose_name = "case study"
verbose_name_plural = "case studies"

name = models.CharField(
max_length=256,
null=False,
blank=False,
episodes = models.ManyToManyField(
to=Episode,
blank=True,
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):
Expand Down
126 changes: 54 additions & 72 deletions backend/conftest.py
Original file line number Diff line number Diff line change
@@ -1,104 +1,86 @@
import pytest
from case_study.models import CaseStudy
from letter.models import Letter
from event.models import (
EpistolaryEvent,
LetterAction,
LetterActionCategory,
WorldEvent,
LetterEventDate,
)
from person.models import Agent
from letter.models import LetterDescription

from person.models import HistoricalPerson, AgentDescription
from source.models import Source
from event.models import EventDescription


@pytest.fixture()
def letter(db):
letter = Letter.objects.create()
letter.name = "letter for testing"
letter.save()
return letter
def source(db):
return Source.objects.create(name="Sesame Street")


@pytest.fixture()
def agent(db):
agent = Agent.objects.create()
agent.name = "Bert"
agent.save()
return agent
def letter_description(db, source, agent_description):
letter = LetterDescription.objects.create(
name="Bert's letter",
source=source,
)
letter.senders.add(agent_description)
return letter


@pytest.fixture()
def agent_2(db):
agent = Agent.objects.create()
agent.name = "Ernie"
agent.save()
return agent
def historical_person(db):
person = HistoricalPerson.objects.create(name="Bert")
return person


@pytest.fixture()
def agent_group(db):
agent_group = Agent.objects.create()
agent_group.name = "The Muppets"
agent_group.is_group = True
agent_group.save()
return agent_group
def historical_person_2(db):
person = HistoricalPerson.objects.create(name="Ernie")
return person


@pytest.fixture()
def letter_action_writing(db, letter, agent):
letter_action = LetterAction.objects.create()
letter_action.letters.add(letter)
letter_action.actors.add(agent)

LetterActionCategory.objects.create(
letter_action=letter_action,
value="write",
def agent_description(db, historical_person, source):
agent = AgentDescription.objects.create(
name="Bert",
source=source,
)

LetterEventDate.objects.create(
year_lower=500, year_upper=500, year_exact=500, letter_action=letter_action
)

return letter_action
agent.describes.add(historical_person)
agent.save()
return agent


@pytest.fixture()
def letter_action_reading(db, letter, agent_2):
letter_action = LetterAction.objects.create()
letter_action.letters.add(letter)
letter_action.actors.add(agent_2)

LetterActionCategory.objects.create(
letter_action=letter_action,
value="read",
)

LetterEventDate.objects.create(
year_lower=505, year_upper=510, letter_action=letter_action
def agent_description_2(db, historical_person, source):
agent = AgentDescription.objects.create(
name="Ernie",
source=source,
)

return letter_action
agent.describes.add(historical_person)
agent.save()
return agent


@pytest.fixture()
def case_study(db):
case_study = CaseStudy.objects.create(name="Test Case Study")
return case_study
def agent_group_description(db, source, historical_person, historical_person_2):
agent = AgentDescription.objects.create(
name="The Muppets",
source=source,
is_group=True,
)
agent.describes.add(historical_person)
agent.describes.add(historical_person_2)
agent.save()
return agent


@pytest.fixture()
def epistolary_event(db, letter, case_study):
epistolary_event = EpistolaryEvent.objects.create(
name="Test Epistolary event", note="Test note"
def event_description(db, source, agent_description, agent_description_2):
event = EventDescription.objects.create(
name="Bert writes a letter",
source=source,
)
epistolary_event.case_studies.add(case_study)

return epistolary_event
event.agents.add(agent_description)
event.agents.add(agent_description_2)
return event


@pytest.fixture()
def world_event(db):
world_event = WorldEvent.objects.create(
name="Test World Event", note="Test World Event note", year_exact=612
)
return world_event
def case_study(db):
case_study = CaseStudy.objects.create(name="Test Case Study")
return case_study
40 changes: 39 additions & 1 deletion backend/core/admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
from django.contrib import admin

# Register your models here.
named_fieldset = (
"Name and description",
{
"description": "Basic information to help identify this description",
"fields": ["name", "description"],
},
)

description_source_fieldset = (
"Source information",
{
"description": "Information about the source from which this description is taken.",
"fields": [
"source",
"source_location",
"source_mention",
],
},
)

date_fields = ["year_lower", "year_upper", "year_exact"]

field_fields = ["certainty", "note"]

description_field_fields = [
"source_mention",
"source_location",
"source_terminology",
] + field_fields


class EntityDescriptionAdmin(admin.ModelAdmin):
list_display = ["name", "description", "source"]
list_filter = ["source"]
search_fields = ["name", "description"]
fieldsets = [
named_fieldset,
description_source_fieldset,
]
Loading

0 comments on commit 5a73ecb

Please sign in to comment.