-
Notifications
You must be signed in to change notification settings - Fork 10
Adiciona RawOrganizationMixin para transição de Institution #1276
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
Changes from all commits
5e15f3a
468fd78
0afad4c
200fc1e
403eea5
4ca5727
9fdf0a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -286,3 +286,4 @@ core/media/ | |
| .ipython/ | ||
| .env | ||
| !.envs/.local/ | ||
| src/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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"), | ||
| ) | ||
|
|
||
| class Meta: | ||
| abstract = True | ||
|
|
||
|
Comment on lines
+280
to
+336
|
||
|
|
||
| class LanguageFallbackManager(models.Manager): | ||
| def get_object_in_preferred_language(self, language): | ||
| mission = self.filter(language=language) | ||
|
|
||
| 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", | ||
| ), | ||
| ), | ||
| ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
RawOrganizationMixindoes not define apanelsattribute for Wagtail admin interface, while other similar mixins in the codebase do (e.g.,CharFieldLangMixinat core/models.py:234,TextWithLangat 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 apanelsattribute 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.