Move Url FK cleaning away from model.clean() so ModelForm don't call it before the fk's have been set, causing unheard mayhem. Fixes #589 and thanks for the report!
This commit is contained in:
parent
7bb79506eb
commit
5c9b71b976
|
@ -118,7 +118,7 @@ class Url(CampRelatedModel):
|
|||
def __str__(self):
|
||||
return self.url
|
||||
|
||||
def clean(self):
|
||||
def clean_fk(self):
|
||||
""" Make sure we have exactly one FK """
|
||||
fks = 0
|
||||
if self.speaker_proposal:
|
||||
|
@ -134,6 +134,11 @@ class Url(CampRelatedModel):
|
|||
f"Url objects must have exactly one FK, this has {fks}"
|
||||
)
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
"""Just clean_fk() and super save()."""
|
||||
self.clean_fk()
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
@property
|
||||
def owner(self):
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue