Commit 65ed4e15 authored by Daniel W Bond's avatar Daniel W Bond
Browse files

outlined class based views for housing app

parent ca790e5f
......@@ -4,9 +4,36 @@ from django.template import RequestContext, loader
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth import authenticate, logout
from housing.models import Building, Room
from braces.views import LoginRequiredMixin
from django.views.generic import DetailView, ListView, CreateView, UpdateView, DeleteView
from housing.models import Building, Room, Student
# 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
class DetailStudent(LoginRequiredMixin, DetailStudent):
model = Student
login_url = '/'
# Create your views here.
def index(request):
template = loader.get_template('index.html')
context = RequestContext(request, {
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