views.py 1.11 KB
Newer Older
1 2 3 4 5 6
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render
from django.template import RequestContext, loader
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth import authenticate, logout

7 8 9 10 11
from braces.views import LoginRequiredMixin

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

from housing.models import Building, Room, Student
12

13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
# a list of neighborhoods and their buildings
class ListBuildings(LoginRequiredMixin, ListView):
    model = Building
    login_url = '/'

# building floors, other information
class DetailBuilding(LoginRequiredMixin, DetailView):
    model = Building
    login_url = '/'

# this lists the rooms on the floor
class ListRooms(LoginRequiredMixin, ListView):
    model = Room
    login_url = '/'

# this lists students in a room
class DetailRoom(LoginRequiredMixin, ListView):
    model = Room
    login_url = '/'

# details about the student
Jason D Yeomans's avatar
Jason D Yeomans committed
34
class DetailStudent(LoginRequiredMixin, DetailView):
35 36
    model = Student
    login_url = '/'
37

38 39 40 41 42
# update a student

# update a room

# update a building