Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -286,3 +286,4 @@ core/media/
.ipython/
.env
!.envs/.local/
src/
58 changes: 58 additions & 0 deletions core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,64 @@ class Meta:
abstract = True


class RawOrganizationMixin(models.Model):
"""
Mixin for storing raw, unstructured organization data.
Intended to replace references to institution.models.Institution.
"""
raw_text = models.TextField(
_("Raw Text"),
null=True,
blank=True,
help_text=_("Free text, unstructured organization data"),
)
raw_institution_name = models.CharField(
_("Raw Institution Name"),
max_length=510,
null=True,
blank=True,
help_text=_("Raw institution name as provided"),
)
raw_country_name = models.CharField(
_("Raw Country Name"),
max_length=255,
null=True,
blank=True,
help_text=_("Raw country name as provided"),
)
raw_country_code = models.CharField(
_("Raw Country Code"),
max_length=3,
null=True,
blank=True,
help_text=_("Raw country code (ISO) as provided"),
)
raw_state_name = models.CharField(
_("Raw State Name"),
max_length=255,
null=True,
blank=True,
help_text=_("Raw state name as provided"),
)
raw_state_acron = models.CharField(
_("Raw State Acronym"),
max_length=10,
null=True,
blank=True,
help_text=_("Raw state acronym as provided"),
)
raw_city_name = models.CharField(
_("Raw City Name"),
max_length=255,
null=True,
blank=True,
help_text=_("Raw city name as provided"),
)

Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The RawOrganizationMixin does not define a panels attribute for Wagtail admin interface, while other similar mixins in the codebase do (e.g., CharFieldLangMixin at core/models.py:234, TextWithLang at core/models.py:253). This means the raw organization fields will not be visible in the Wagtail admin interface unless explicitly added to each model's panels. Consider adding a panels attribute to the mixin with FieldPanel entries for the raw organization fields, making them automatically available in the admin interface for all models that inherit from this mixin.

Suggested change
panels = [
FieldPanel("raw_text"),
FieldPanel("raw_institution_name"),
FieldPanel("raw_country_name"),
FieldPanel("raw_country_code"),
FieldPanel("raw_state_name"),
FieldPanel("raw_state_acron"),
FieldPanel("raw_city_name"),
]

Copilot uses AI. Check for mistakes.
class Meta:
abstract = True

Comment on lines +280 to +336
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Several fields from the RawOrganizationMixin are never populated in the codebase: raw_text, raw_country_code, and raw_state_acron. While these fields exist in the model definition (core/models.py lines 285-290, 305-311, 319-325) and are added via migration, they are not used in any of the add_* method calls in am_to_core.py or in the migration task in tasks.py. If these fields are not needed for the current use case, consider documenting their intended future use in the mixin docstring. If they should be populated now, add logic to extract and store the appropriate values from the source data.

Copilot uses AI. Check for mistakes.

class LanguageFallbackManager(models.Manager):
def get_object_in_preferred_language(self, language):
mission = self.filter(language=language)
Expand Down
321 changes: 321 additions & 0 deletions journal/migrations/0055_add_raw_organization_fields.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,321 @@
# Generated manually for adding RawOrganizationMixin fields

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("journal", "0054_journaltableofcontents"),
]

operations = [
# Add RawOrganizationMixin fields to OwnerHistory
migrations.AddField(
model_name="ownerhistory",
name="raw_text",
field=models.TextField(
blank=True,
help_text="Free text, unstructured organization data",
null=True,
verbose_name="Raw Text",
),
),
migrations.AddField(
model_name="ownerhistory",
name="raw_institution_name",
field=models.CharField(
blank=True,
help_text="Raw institution name as provided",
max_length=510,
null=True,
verbose_name="Raw Institution Name",
),
),
migrations.AddField(
model_name="ownerhistory",
name="raw_country_name",
field=models.CharField(
blank=True,
help_text="Raw country name as provided",
max_length=255,
null=True,
verbose_name="Raw Country Name",
),
),
migrations.AddField(
model_name="ownerhistory",
name="raw_country_code",
field=models.CharField(
blank=True,
help_text="Raw country code (ISO) as provided",
max_length=3,
null=True,
verbose_name="Raw Country Code",
),
),
migrations.AddField(
model_name="ownerhistory",
name="raw_state_name",
field=models.CharField(
blank=True,
help_text="Raw state name as provided",
max_length=255,
null=True,
verbose_name="Raw State Name",
),
),
migrations.AddField(
model_name="ownerhistory",
name="raw_state_acron",
field=models.CharField(
blank=True,
help_text="Raw state acronym as provided",
max_length=10,
null=True,
verbose_name="Raw State Acronym",
),
),
migrations.AddField(
model_name="ownerhistory",
name="raw_city_name",
field=models.CharField(
blank=True,
help_text="Raw city name as provided",
max_length=255,
null=True,
verbose_name="Raw City Name",
),
),
# Add RawOrganizationMixin fields to PublisherHistory
migrations.AddField(
model_name="publisherhistory",
name="raw_text",
field=models.TextField(
blank=True,
help_text="Free text, unstructured organization data",
null=True,
verbose_name="Raw Text",
),
),
migrations.AddField(
model_name="publisherhistory",
name="raw_institution_name",
field=models.CharField(
blank=True,
help_text="Raw institution name as provided",
max_length=510,
null=True,
verbose_name="Raw Institution Name",
),
),
migrations.AddField(
model_name="publisherhistory",
name="raw_country_name",
field=models.CharField(
blank=True,
help_text="Raw country name as provided",
max_length=255,
null=True,
verbose_name="Raw Country Name",
),
),
migrations.AddField(
model_name="publisherhistory",
name="raw_country_code",
field=models.CharField(
blank=True,
help_text="Raw country code (ISO) as provided",
max_length=3,
null=True,
verbose_name="Raw Country Code",
),
),
migrations.AddField(
model_name="publisherhistory",
name="raw_state_name",
field=models.CharField(
blank=True,
help_text="Raw state name as provided",
max_length=255,
null=True,
verbose_name="Raw State Name",
),
),
migrations.AddField(
model_name="publisherhistory",
name="raw_state_acron",
field=models.CharField(
blank=True,
help_text="Raw state acronym as provided",
max_length=10,
null=True,
verbose_name="Raw State Acronym",
),
),
migrations.AddField(
model_name="publisherhistory",
name="raw_city_name",
field=models.CharField(
blank=True,
help_text="Raw city name as provided",
max_length=255,
null=True,
verbose_name="Raw City Name",
),
),
# Add RawOrganizationMixin fields to SponsorHistory
migrations.AddField(
model_name="sponsorhistory",
name="raw_text",
field=models.TextField(
blank=True,
help_text="Free text, unstructured organization data",
null=True,
verbose_name="Raw Text",
),
),
migrations.AddField(
model_name="sponsorhistory",
name="raw_institution_name",
field=models.CharField(
blank=True,
help_text="Raw institution name as provided",
max_length=510,
null=True,
verbose_name="Raw Institution Name",
),
),
migrations.AddField(
model_name="sponsorhistory",
name="raw_country_name",
field=models.CharField(
blank=True,
help_text="Raw country name as provided",
max_length=255,
null=True,
verbose_name="Raw Country Name",
),
),
migrations.AddField(
model_name="sponsorhistory",
name="raw_country_code",
field=models.CharField(
blank=True,
help_text="Raw country code (ISO) as provided",
max_length=3,
null=True,
verbose_name="Raw Country Code",
),
),
migrations.AddField(
model_name="sponsorhistory",
name="raw_state_name",
field=models.CharField(
blank=True,
help_text="Raw state name as provided",
max_length=255,
null=True,
verbose_name="Raw State Name",
),
),
migrations.AddField(
model_name="sponsorhistory",
name="raw_state_acron",
field=models.CharField(
blank=True,
help_text="Raw state acronym as provided",
max_length=10,
null=True,
verbose_name="Raw State Acronym",
),
),
migrations.AddField(
model_name="sponsorhistory",
name="raw_city_name",
field=models.CharField(
blank=True,
help_text="Raw city name as provided",
max_length=255,
null=True,
verbose_name="Raw City Name",
),
),
# Add RawOrganizationMixin fields to CopyrightHolderHistory
migrations.AddField(
model_name="copyrightholderhistory",
name="raw_text",
field=models.TextField(
blank=True,
help_text="Free text, unstructured organization data",
null=True,
verbose_name="Raw Text",
),
),
migrations.AddField(
model_name="copyrightholderhistory",
name="raw_institution_name",
field=models.CharField(
blank=True,
help_text="Raw institution name as provided",
max_length=510,
null=True,
verbose_name="Raw Institution Name",
),
),
migrations.AddField(
model_name="copyrightholderhistory",
name="raw_country_name",
field=models.CharField(
blank=True,
help_text="Raw country name as provided",
max_length=255,
null=True,
verbose_name="Raw Country Name",
),
),
migrations.AddField(
model_name="copyrightholderhistory",
name="raw_country_code",
field=models.CharField(
blank=True,
help_text="Raw country code (ISO) as provided",
max_length=3,
null=True,
verbose_name="Raw Country Code",
),
),
migrations.AddField(
model_name="copyrightholderhistory",
name="raw_state_name",
field=models.CharField(
blank=True,
help_text="Raw state name as provided",
max_length=255,
null=True,
verbose_name="Raw State Name",
),
),
migrations.AddField(
model_name="copyrightholderhistory",
name="raw_state_acron",
field=models.CharField(
blank=True,
help_text="Raw state acronym as provided",
max_length=10,
null=True,
verbose_name="Raw State Acronym",
),
),
migrations.AddField(
model_name="copyrightholderhistory",
name="raw_city_name",
field=models.CharField(
blank=True,
help_text="Raw city name as provided",
max_length=255,
null=True,
verbose_name="Raw City Name",
),
),
]
Loading
Loading