-
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
98 changed files
with
4,334 additions
and
1,896 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
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,46 @@ | ||
from allauth.account.models import EmailAddress | ||
import pytest | ||
|
||
from case_study.models import CaseStudy | ||
from letter.models import LetterDescription | ||
|
||
from person.models import HistoricalPerson, AgentDescription | ||
from source.models import Source | ||
from event.models import EventDescription | ||
from user.models import User | ||
|
||
|
||
@pytest.fixture() | ||
def user_data(): | ||
return { | ||
"username": "JohnDoe", | ||
"email": "[email protected]", | ||
"password": "secretpassword", | ||
"first_name": "John", | ||
"last_name": "Doe", | ||
} | ||
|
||
|
||
@pytest.fixture() | ||
def user(db, user_data): | ||
user = User.objects.create( | ||
username=user_data["username"], | ||
email=user_data["email"], | ||
password=user_data["password"], | ||
first_name=user_data["first_name"], | ||
last_name=user_data["last_name"], | ||
) | ||
EmailAddress.objects.create( | ||
user=user, email=user.email, verified=True, primary=True | ||
) | ||
return user | ||
|
||
|
||
@pytest.fixture | ||
def user_client(client, user): | ||
client.force_login(user) | ||
yield client | ||
client.logout() | ||
|
||
|
||
@pytest.fixture() | ||
|
@@ -13,12 +49,11 @@ def source(db): | |
|
||
|
||
@pytest.fixture() | ||
def letter_description(db, source, agent_description): | ||
def letter_description(db, source): | ||
letter = LetterDescription.objects.create( | ||
name="Bert's letter", | ||
source=source, | ||
) | ||
letter.senders.add(agent_description) | ||
return letter | ||
|
||
|
||
|
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
78 changes: 78 additions & 0 deletions
78
backend/event/migrations/0016_remove_eventdescription_source_location_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,78 @@ | ||
# Generated by Django 4.2.7 on 2024-04-25 10:13 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
def migrate_source_location_to_page(apps, schema_editor): | ||
EventDescription = apps.get_model("event", "EventDescription") | ||
for event_description in EventDescription.objects.all(): | ||
if event_description.source_location: | ||
event_description.page = event_description.source_location | ||
event_description.save() | ||
|
||
|
||
def migrate_page_to_source_location(apps, schema_editor): | ||
EventDescription = apps.get_model("event", "EventDescription") | ||
for event_description in EventDescription.objects.all(): | ||
if event_description.page: | ||
event_description.source_location = event_description.page | ||
event_description.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("event", "0015_alter_eventcategory_options_episode"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="eventdescription", | ||
name="book", | ||
field=models.CharField( | ||
blank=True, help_text="The book in the source", max_length=255 | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="eventdescription", | ||
name="chapter", | ||
field=models.CharField( | ||
blank=True, | ||
help_text="The chapter or chapters in the source", | ||
max_length=255, | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="eventdescription", | ||
name="page", | ||
field=models.CharField( | ||
blank=True, | ||
help_text="The page number or page range in the source", | ||
max_length=255, | ||
), | ||
), | ||
migrations.RunPython( | ||
code=migrate_source_location_to_page, | ||
reverse_code=migrate_page_to_source_location, | ||
), | ||
migrations.RemoveField( | ||
model_name="eventdescription", | ||
name="source_location", | ||
), | ||
migrations.RemoveField( | ||
model_name="eventdescriptionagent", | ||
name="source_location", | ||
), | ||
migrations.RemoveField( | ||
model_name="eventdescriptiongift", | ||
name="source_location", | ||
), | ||
migrations.RemoveField( | ||
model_name="eventdescriptionletter", | ||
name="source_location", | ||
), | ||
migrations.RemoveField( | ||
model_name="eventdescriptionspace", | ||
name="source_location", | ||
), | ||
] |
41 changes: 41 additions & 0 deletions
41
backend/event/migrations/0017_remove_eventdescriptionagent_source_terminology_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,41 @@ | ||
# Generated by Django 4.2.7 on 2024-05-17 13:15 | ||
|
||
import django.contrib.postgres.fields | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("event", "0016_remove_eventdescription_source_location_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name="eventdescriptionagent", | ||
name="source_terminology", | ||
), | ||
migrations.RemoveField( | ||
model_name="eventdescriptiongift", | ||
name="source_terminology", | ||
), | ||
migrations.RemoveField( | ||
model_name="eventdescriptionletter", | ||
name="source_terminology", | ||
), | ||
migrations.RemoveField( | ||
model_name="eventdescriptionspace", | ||
name="source_terminology", | ||
), | ||
migrations.AddField( | ||
model_name="eventdescription", | ||
name="designators", | ||
field=django.contrib.postgres.fields.ArrayField( | ||
base_field=models.CharField(max_length=200), | ||
blank=True, | ||
default=list, | ||
help_text="Relevant (Latin) terminology used to describe this entity in the source text", | ||
size=5, | ||
), | ||
), | ||
] |
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
Oops, something went wrong.