Delete draft when submitting case study (#52)
This commit is contained in:
parent
054668e1e8
commit
a41df71793
@ -533,10 +533,6 @@ function initDrafts() {
|
||||
button.switchStateSaveFailed();
|
||||
})
|
||||
})
|
||||
|
||||
document.forms['case-study-form'].addEventListener('submit', () => {
|
||||
// XXX We're submitting, so kosh the saved data
|
||||
})
|
||||
}
|
||||
|
||||
// https://github.com/snikch/jquery.dirtyforms
|
||||
|
@ -54,6 +54,12 @@ class BaseForm(LoginRequiredMixin, CreateView):
|
||||
def form_valid(self, form):
|
||||
self.object = form.save()
|
||||
self.send_email()
|
||||
|
||||
# Delete the corresponding draft
|
||||
draft = CaseStudyDraft.objects.get(author=request.user)
|
||||
if draft:
|
||||
draft.delete()
|
||||
|
||||
return super().form_valid(form)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user