-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use boolean is_structured_data, not data_type
for seeAlso (#958)
- Loading branch information
Showing
5 changed files
with
60 additions
and
21 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
38 changes: 38 additions & 0 deletions
38
apps/iiif/manifests/migrations/0060_relatedlink_is_structured_data.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,38 @@ | ||
# Generated by Django 3.2.12 on 2023-12-05 19:59 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
def populate_is_structured_data(apps, schema_editor): | ||
# Data migration to populate RelatedLink.is_structured_data for existing data | ||
RelatedLink = apps.get_model("manifests", "RelatedLink") | ||
rl_set = RelatedLink.objects.all() | ||
for rl in rl_set: | ||
# Assume all existing RelatedLinks are structured data, since they were previously only | ||
# being added in Remote ingests when there was an existing manifest (which is structured | ||
# data) | ||
rl.is_structured_data = True | ||
RelatedLink.objects.bulk_update(rl_set, ["is_structured_data"], batch_size=1000) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("manifests", "0059_alter_relatedlink_id"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="relatedlink", | ||
name="is_structured_data", | ||
field=models.BooleanField( | ||
default=False, | ||
help_text="True if this link is structured data that should appear in the manifest's 'seeAlso' field; if false, the link will appear in the 'related' field instead. Leave unchecked if unsure.", | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="relatedlink", | ||
name="data_type", | ||
field=models.CharField(default="Dataset", max_length=255), | ||
), | ||
migrations.RunPython(populate_is_structured_data, migrations.RunPython.noop), | ||
] |
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
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