Skip to content

Commit

Permalink
Fix RelatedLink uuid errors on save/change
Browse files Browse the repository at this point in the history
  • Loading branch information
blms committed Dec 5, 2023
1 parent 6990da8 commit 1e057a3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 2 additions & 0 deletions apps/iiif/manifests/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Django admin module for maninfests"""
from django.contrib import admin
from django.http import HttpResponseRedirect
from django.http.request import HttpRequest
from django.urls.conf import path
from import_export import resources, fields
from import_export.admin import ImportExportModelAdmin
Expand Down Expand Up @@ -35,6 +36,7 @@ class Meta: # pylint: disable=too-few-public-methods, missing-class-docstring

class RelatedLinksInline(admin.TabularInline):
model = RelatedLink
exclude = ("id",)
fields = (
"link",
"data_type",
Expand Down
20 changes: 20 additions & 0 deletions apps/iiif/manifests/migrations/0059_alter_relatedlink_id.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 3.2.12 on 2023-12-05 19:41

from django.db import migrations, models
import uuid


class Migration(migrations.Migration):
dependencies = [
("manifests", "0058_alter_relatedlink_format_and_data_type"),
]

operations = [
migrations.AlterField(
model_name="relatedlink",
name="id",
field=models.UUIDField(
default=uuid.uuid4, editable=False, primary_key=True, serialize=False
),
),
]
2 changes: 1 addition & 1 deletion apps/iiif/manifests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ class Note(models.Model):

class RelatedLink(models.Model):
""" Links to related resources """
id = models.UUIDField(primary_key=True, default=uuid4)
id = models.UUIDField(primary_key=True, default=uuid4, editable=False)
link = models.CharField(max_length=255)
data_type = models.CharField(
max_length=255,
Expand Down

0 comments on commit 1e057a3

Please sign in to comment.