Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
roomlist
Commits
65ed4e15
Commit
65ed4e15
authored
Nov 22, 2014
by
Daniel W Bond
Browse files
outlined class based views for housing app
parent
ca790e5f
Changes
1
Show whitespace changes
Inline
Side-by-side
roomlist/housing/views.py
View file @
65ed4e15
...
@@ -4,9 +4,36 @@ from django.template import RequestContext, loader
...
@@ -4,9 +4,36 @@ from django.template import RequestContext, loader
from
django.contrib.auth.forms
import
AuthenticationForm
from
django.contrib.auth.forms
import
AuthenticationForm
from
django.contrib.auth
import
authenticate
,
logout
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
):
def
index
(
request
):
template
=
loader
.
get_template
(
'index.html'
)
template
=
loader
.
get_template
(
'index.html'
)
context
=
RequestContext
(
request
,
{
context
=
RequestContext
(
request
,
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment