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