1👍
✅
You can use form_valid instead of post and get a lot of the checks you’ve tried to do there for free, and model.clean() is called as part of the form validation process.
def form_valid(form):
form.save()
return self.get_success_url(slug=model.slug)
You may also do better letting the parent class handle the default arguements for save
def save(self, *args, **kwargs):
if self.slug is None:
self.slug = slugify(self.title)+'-'+str(self.id)
super(Question, self).save(*args, **kwargs)
It could be that your update_fields=None could be preventing the save, see Django Model instance reference
EDIT as per the comment, you should be returning a URL. Use reverse() rather than redirect django.urls utility functions
Source:stackexchange.com