2👍
✅
ArticleForm.save()
parameters are not used in Article.save()
method unless you pass them explicitly. force_insert
and force_update
are default Model.save()
arguments, as stated in Django model save documentation. Their values depend on how you call the Model.save()
method.
Also, your Article save method should look like this:
class Article(models.Model):
...
def save(self, *args, **kwargs):
if (self.is_draft == False) and (self.date_published == None):
self.date_published = datetime.now()
super(Article, self).save(*args, **kwargs)
Source:stackexchange.com