Skip to content

Commit

Permalink
fix: the contenttype of the rootobject should not be user editable
Browse files Browse the repository at this point in the history
  • Loading branch information
b1rger committed Oct 16, 2023
1 parent e40ecb3 commit 872386e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 4.1.11 on 2023-10-11 10:14

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
("contenttypes", "0002_remove_content_type_name"),
("apis_metainfo", "0007_delete_source"),
]

operations = [
migrations.AlterField(
model_name="rootobject",
name="self_contenttype",
field=models.ForeignKey(
blank=True,
editable=False,
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="contenttypes.contenttype",
),
),
]
6 changes: 5 additions & 1 deletion apis_core/apis_metainfo/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ class RootObject(models.Model):
# triples where the subject's or object's contenttype must be respected (e.g. get all triples
# where the subject is a Person)
self_contenttype = models.ForeignKey(
ContentType, on_delete=models.deletion.CASCADE, null=True, blank=True
ContentType,
on_delete=models.deletion.CASCADE,
null=True,
blank=True,
editable=False,
)
objects = models.Manager()
objects_inheritance = InheritanceManager()
Expand Down

0 comments on commit 872386e

Please sign in to comment.