3 ms·
This code will cause problems with some parts of Django. I forget where, but I have encountered problems writing code like this before because sometimes the sav
by almost 17y ago
This code will cause problems with some parts of Django. I forget where, but I have encountered problems writing code like this before because sometimes the save method gets called by things which expect it to take its optional parameters. This is a more robust (although certainly uglier) version:
def save(self, *args, **kwargs):
if not self.pk:
pass # new object
else:
pass # old object
return super(MyObject, self).save(*args, **kwargs)