From cd1550ecd32518a8d198ec153ac15c1be1d1a264 Mon Sep 17 00:00:00 2001 From: Ben Silverman Date: Tue, 5 Dec 2023 11:18:31 -0500 Subject: [PATCH] new RelatedLink format choices, update helptext ref #958 --- apps/iiif/choices.py | 6 ++- ..._alter_relatedlink_format_and_data_type.py | 39 +++++++++++++++++++ apps/iiif/manifests/models.py | 8 +++- 3 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 apps/iiif/manifests/migrations/0058_alter_relatedlink_format_and_data_type.py diff --git a/apps/iiif/choices.py b/apps/iiif/choices.py index 0a10fe196..0d9b60831 100644 --- a/apps/iiif/choices.py +++ b/apps/iiif/choices.py @@ -6,11 +6,13 @@ class Choices(): """ List of Mime type choices. """ MIMETYPES = ( - ('text/html', 'HTML'), + ('text/html', 'HTML or web page'), ('application/json', 'JSON'), ('application/ld+json', 'JSON-LD'), + ('application/pdf', 'PDF'), + ('text/plain', 'Text'), ('application/xml', 'XML'), - ('text/plan', 'Text'), + ('application/octet-stream', 'Other'), ) """ diff --git a/apps/iiif/manifests/migrations/0058_alter_relatedlink_format_and_data_type.py b/apps/iiif/manifests/migrations/0058_alter_relatedlink_format_and_data_type.py new file mode 100644 index 000000000..875e79d25 --- /dev/null +++ b/apps/iiif/manifests/migrations/0058_alter_relatedlink_format_and_data_type.py @@ -0,0 +1,39 @@ +# Generated by Django 3.2.12 on 2023-12-05 16:16 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("manifests", "0057_alter_manifest_languages"), + ] + + operations = [ + migrations.AlterField( + model_name="relatedlink", + name="data_type", + field=models.CharField( + default="Dataset", + help_text="Leave as 'Dataset' for structured data describing this document (e.g. a remote manifest) and this link will appear in 'seeAlso'; change to any other value and it will only appear in the 'related' property of the manifest.", + max_length=255, + ), + ), + 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, + ), + ), + ] diff --git a/apps/iiif/manifests/models.py b/apps/iiif/manifests/models.py index b3eb4c654..426f0f31b 100644 --- a/apps/iiif/manifests/models.py +++ b/apps/iiif/manifests/models.py @@ -341,7 +341,13 @@ class RelatedLink(models.Model): """ Links to related resources """ id = models.UUIDField(primary_key=True, default=uuid4) link = models.CharField(max_length=255) - data_type = models.CharField(max_length=255, default='Dataset') + data_type = models.CharField( + max_length=255, + default='Dataset', + help_text="Leave as 'Dataset' for structured data describing this document (e.g. a " + + "remote manifest) and this link will appear in 'seeAlso'; change to any other value and " + + "it will only appear in the 'related' property of the manifest.", + ) label = GenericRelation(ValueByLanguage) format = models.CharField(max_length=255, choices=Choices.MIMETYPES, blank=True, null=True) profile = models.CharField(max_length=255, blank=True, null=True)