Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/source description split (agents, spaces) #48

Merged
merged 16 commits into from
Apr 15, 2024
Merged
55 changes: 36 additions & 19 deletions backend/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@
WorldEvent,
LetterEventDate,
)
from person.models import Agent
from person.models import HistoricalPerson, AgentDescription
from source.models import Source


@pytest.fixture()
def source(db):
return Source.objects.create(name="Sesame Street")


@pytest.fixture()
Expand All @@ -20,35 +26,46 @@ def letter(db):


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


@pytest.fixture()
def historical_person_2(db):
person = HistoricalPerson.objects.create(name="Ernie")
return person


@pytest.fixture()
def agent_2(db):
agent = Agent.objects.create()
agent.name = "Ernie"
def agent_description(db, historical_person, source):
agent = AgentDescription.objects.create(
name="Bert",
source=source,
)
agent.describes.add(historical_person)
agent.save()
return agent


@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 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 letter_action_writing(db, letter, agent):
def letter_action_writing(db, letter):
letter_action = LetterAction.objects.create()
letter_action.letters.add(letter)
letter_action.actors.add(agent)
# letter_action.actors.add(agent)

LetterActionCategory.objects.create(
letter_action=letter_action,
Expand All @@ -63,10 +80,10 @@ def letter_action_writing(db, letter, agent):


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

LetterActionCategory.objects.create(
letter_action=letter_action,
Expand Down
30 changes: 29 additions & 1 deletion backend/core/admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
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
Loading
Loading