Commit 4d8337c7 authored by Daniel W Bond's avatar Daniel W Bond
Browse files

new urls for updatestudent

parent ecf036dd
from django.shortcuts import render, get_object_or_404 from django.shortcuts import render, get_object_or_404
from django.views.generic import DetailView, ListView, CreateView, UpdateView, DeleteView from django.views.generic import DetailView, ListView, UpdateView, UpdateView, DeleteView
from accounts.models import Student from accounts.models import Student
from accounts.forms import StudentForm
from braces.views import LoginRequiredMixin from braces.views import LoginRequiredMixin
# create a student # update a student (students are *created* on first login via CAS)
class CreateStudent(LoginRequiredMixin, CreateView): class UpdateStudent(LoginRequiredMixin, UpdateView):
model = Student model = Student
form_class = StudentForm fields = ['room', 'privacy',]
success_url = '/' #redirect location tba
login_url = '/' login_url = '/'
# copied from below
def get_object(self):
return get_object_or_404(Student, pk=self.request.session['_auth_user_id'])
# details about the student # details about the student
class DetailStudent(LoginRequiredMixin, DetailView): class DetailStudent(LoginRequiredMixin, DetailView):
model = Student model = 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