Prevent crash saving case study with no draft
This commit is contained in:
parent
562fa1f270
commit
c0ff616761
@ -79,9 +79,11 @@ class BaseForm(LoginRequiredMixin, CreateView):
|
||||
self.send_email()
|
||||
|
||||
# Delete the corresponding draft
|
||||
draft = CaseStudyDraft.objects.get(author=self.request.user)
|
||||
if draft:
|
||||
try:
|
||||
draft = CaseStudyDraft.objects.get(author=self.request.user)
|
||||
draft.delete()
|
||||
except CaseStudyDraft.DoesNotExist:
|
||||
pass
|
||||
|
||||
return super().form_valid(form)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user