-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
54 changed files
with
2,448 additions
and
1,283 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
37 changes: 37 additions & 0 deletions
37
...case_study/migrations/0002_casestudy_description_alter_casestudy_name_episode_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", | ||
), | ||
), | ||
] |
25 changes: 25 additions & 0 deletions
25
backend/case_study/migrations/0003_casestudy_key_persons_casestudy_key_sites.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
] |
Oops, something went wrong.