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

created basics on view to delete student-- note using formview (for feedback...

created basics on view to delete student-- note using formview (for feedback and to delete user object as well) and not deleteview
parent b40ee2a0
......@@ -17,7 +17,7 @@ from cas.views import login as cas_login
from ratelimit.decorators import ratelimit
# imports from your apps
from .models import Student, Major, Confirmation
from .forms import StudentUpdateForm
from .forms import StudentUpdateForm, FarewellFeedbackForm
from .student_messages import return_messages
from housing.views import shadowbanning
......@@ -301,6 +301,31 @@ class UpdateStudent(LoginRequiredMixin, FormValidMessageMixin, FormView):
kwargs={'slug': self.request.user.username})
class DeleteStudent(FormView):
form_class = FarewellFeedbackForm
template_name = 'delete_student.html'
def get_context_data(self, **kwargs):
context = super(DeleteStudent, self).get_context_data(**kwargs)
me = Student.objects.get(user=self.request.user)
context['student'] = me
return context
def form_valid(self, form):
user = self.request.user
student = self.request.user.student
student.delete()
user.delete()
return super(DeleteStudent, self).form_valid(form)
def get_success_url(self):
return reverse('homepage')
# majors pages
class ListMajors(ListView):
model = Major
......
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