Commit eb1884d1 authored by Marthijn van den Nieuwenhuizen's avatar Marthijn van den Nieuwenhuizen
Browse files

Success message added upon succesful upload of exam or summary

parent ba548101
...@@ -157,7 +157,7 @@ class SummaryDetailView(DetailView): ...@@ -157,7 +157,7 @@ class SummaryDetailView(DetailView):
@method_decorator(login_required, "dispatch") @method_decorator(login_required, "dispatch")
@method_decorator(membership_required, "dispatch") @method_decorator(membership_required, "dispatch")
class ExamCreateView(CreateView): class ExamCreateView(SuccessMessageMixin, CreateView):
""" """
Renders the form to submit a new exam Renders the form to submit a new exam
""" """
...@@ -179,8 +179,7 @@ class ExamCreateView(CreateView): ...@@ -179,8 +179,7 @@ class ExamCreateView(CreateView):
self.object.uploader = self.request.member self.object.uploader = self.request.member
self.object.uploader_date = datetime.now() self.object.uploader_date = datetime.now()
self.object.save() self.object.save()
messages.success(self.request, self.success_message) return super().form_valid(form)
return HttpResponseRedirect(self.get_success_url())
@method_decorator(login_required, "dispatch") @method_decorator(login_required, "dispatch")
...@@ -207,8 +206,7 @@ class SummaryCreateView(CreateView): ...@@ -207,8 +206,7 @@ class SummaryCreateView(CreateView):
self.object.uploader = self.request.member self.object.uploader = self.request.member
self.object.uploader_date = datetime.now() self.object.uploader_date = datetime.now()
self.object.save() self.object.save()
messages.success(self.request, self.success_message) super().form_valid(form)
return HttpResponseRedirect(self.get_success_url())
@method_decorator(login_required, "dispatch") @method_decorator(login_required, "dispatch")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment