Collection main_item: make a OneToOneField intsead of just a foreign key.

This commit is contained in:
Tom Hacohen
2020-09-22 11:33:17 +03:00
parent 7b8b0a5685
commit 18b3f45b79
2 changed files with 20 additions and 1 deletions

View File

@@ -28,7 +28,7 @@ UidValidator = RegexValidator(regex=r'^[a-zA-Z0-9\-_]{20,}$', message='Not a val
class Collection(models.Model):
main_item = models.ForeignKey('CollectionItem', related_name='parent', null=True, on_delete=models.SET_NULL)
main_item = models.OneToOneField('CollectionItem', related_name='parent', null=True, on_delete=models.SET_NULL)
owner = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
def __str__(self):