views.py 557 Bytes
Newer Older
Jason D Yeomans's avatar
Jason D Yeomans committed
1
2
from django.shortcuts import render

3
4
from django.views.generic import DetailView, ListView, CreateView, UpdateView, DeleteView

5
from accounts.models import Student
Daniel W Bond's avatar
Daniel W Bond committed
6
from accounts.forms import StudentForm
7
8
9

from braces.views import LoginRequiredMixin

Daniel W Bond's avatar
Daniel W Bond committed
10
11
12
13
14
15
16
# create a student
class CreateStudent(LoginRequiredMixin, CreateView):
    model = Student
    form_class = StudentForm
    success_url = '/' #redirect location tba
    login_url = '/'

17
18
19
20
# details about the student
class DetailStudent(LoginRequiredMixin, DetailView):
    model = Student
    login_url = '/'