Skip to content

Commit

Permalink
fix: let source targets be null
Browse files Browse the repository at this point in the history
  • Loading branch information
b1rger committed Oct 3, 2023
1 parent 91112ff commit c8361bd
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Django 4.1.11 on 2023-10-03 10:13

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


class Migration(migrations.Migration):

dependencies = [
('contenttypes', '0002_remove_content_type_name'),
('apis_ontology', '0007_alter_source_content_type_alter_source_object_id'),
]

operations = [
migrations.AlterField(
model_name='source',
name='content_type',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype'),
),
migrations.AlterField(
model_name='source',
name='object_id',
field=models.PositiveIntegerField(blank=True, null=True),
),
]
4 changes: 2 additions & 2 deletions apis_ontology/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class Source(models.Model):
author = models.CharField(max_length=255, blank=True)
orig_id = models.PositiveIntegerField(blank=True, null=True)

content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE, blank=True)
object_id = models.PositiveIntegerField(blank=True)
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE, blank=True, null=True)
object_id = models.PositiveIntegerField(blank=True, null=True)
content_object = GenericForeignKey('content_type', 'object_id')

def __str__(self):
Expand Down

0 comments on commit c8361bd

Please sign in to comment.