Commit 5c31f62b authored by Daniel W Bond's avatar Daniel W Bond
Browse files

additional duplicate code removed through studentcontextmixin

parent f8d3826e
......@@ -21,6 +21,7 @@ from .forms import StudentUpdateForm, FarewellFeedbackForm
from housing.models import Room
from core.utils import (shadowbanning, on_the_same_floor, pk_or_none, create_email,
from core.views import StudentContextMixin
# details about the student
......@@ -275,7 +276,7 @@ class UpdateStudent(LoginRequiredMixin, FormValidMessageMixin, FormView):
kwargs={'slug': self.request.user.username})
class DeleteStudent(FormView):
class DeleteStudent(LoginRequiredMixin, StudentContextMixin, FormView):
form_class = FarewellFeedbackForm
template_name = 'delete_student.html'
......@@ -302,15 +303,6 @@ class DeleteStudent(FormView):
return super(DeleteStudent, self).get(request, *args, **kwargs)
def get_context_data(self, **kwargs):
context = super(DeleteStudent, self).get_context_data(**kwargs)
me = self.request.user.student
context['student'] = me
return context
def form_valid(self, form):
user = self.request.user
student = self.request.user.student
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