Commit be90d9d8 authored by Daniel W Bond's avatar Daniel W Bond

a byproduct of writing tests-- this set of logic requires different indentation

parent 2d7bf092
......@@ -544,15 +544,21 @@ class DeleteConfirmation(LoginRequiredMixin, DeleteView):
def get(self, request, *args, **kwargs):
requester = self.request.user.student
try:
confirmer = self.get_object().confirmer
except ObjectDoesNotExist:
raise Http404
current_url = self.request.get_full_path()
confirmer_uname = current_url.split('/')[3]
confirmer = Student.objects.get(user__username=confirmer_uname)
# only the person who created the confirmation may delete it
if not(requester == confirmer):
return HttpResponseForbidden()
# however, if the confirmation just flat out doesn't exist...
else:
return super(DeleteConfirmation, self).get(request, *args, **kwargs)
try:
confirmer = self.get_object().confirmer
except ObjectDoesNotExist:
raise Http404
else:
return super(DeleteConfirmation, self).get(request, *args, **kwargs)
def get_object(self):
current_url = self.request.get_full_path()
......
Markdown is supported
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