-
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.
Merge pull request #1002 from ecds/feature/958-external-files
- Loading branch information
Showing
11 changed files
with
225 additions
and
24 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
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,59 @@ | ||
# Generated by Django 3.2.12 on 2023-12-05 16:16 | ||
|
||
from django.db import migrations, models | ||
import uuid | ||
|
||
|
||
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", "0057_alter_manifest_languages"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="relatedlink", | ||
name="id", | ||
field=models.UUIDField( | ||
default=uuid.uuid4, editable=False, primary_key=True, serialize=False | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="relatedlink", | ||
name="format", | ||
field=models.CharField( | ||
blank=True, | ||
choices=[ | ||
("text/html", "HTML or web page"), | ||
("application/json", "JSON"), | ||
("application/ld+json", "JSON-LD"), | ||
("application/pdf", "PDF"), | ||
("text/plain", "Text"), | ||
("application/xml", "XML"), | ||
("application/octet-stream", "Other"), | ||
], | ||
max_length=255, | ||
null=True, | ||
), | ||
), | ||
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.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
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
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