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
7c175628
Commit
7c175628
authored
Feb 18, 2015
by
Daniel W Bond
Browse files
implemented onFloor and inBuilding
parent
5e7fac32
Changes
1
Hide whitespace changes
Inline
Side-by-side
roomlist/housing/views.py
View file @
7c175628
...
...
@@ -36,14 +36,21 @@ class DetailFloor(LoginRequiredMixin, DetailView):
context_object_name
=
'floor'
template_name
=
detail_floor
.
html
requesting_student
=
Student
.
objects
.
filter
(
user
=
self
.
request
.
user
)
# if self.request.user is on the floor
def
onFloor
():
# if self.request.user is on the floor
return
False
floor_status
=
False
if
requesting_student
.
get_floor
==
self
.
get_object
():
floor_status
=
True
return
floor_status
# if self.request.user is in the building
def
inBuilding
():
inBuilding
=
False
# if self.request.user is in the building
return
False
building_status
=
False
if
requesting_student
.
get_building
==
self
.
get_object
().
building
:
building_status
=
True
return
building_status
rooms
=
Room
.
objects
.
filter
(
floor
=
self
.
get_object
()).
order_by
(
'-number'
)
floor_students
=
[]
...
...
@@ -67,14 +74,21 @@ class DetailRoom(LoginRequiredMixin, DetailView):
context_object_name
=
'room'
template_name
=
'detailBuilding.html'
requesting_student
=
Student
.
objects
.
filter
(
user
=
self
.
request
.
user
)
# if self.request.user is on the floor
def
onFloor
():
# if self.request.user is on the floor
return
False
floor_status
=
False
if
requesting_student
.
get_floor
==
self
.
get_object
().
floor
:
floor_status
=
True
return
floor_status
# if self.request.user is in the building
def
inBuilding
():
inBuilding
=
False
# if self.request.user is in the building
return
False
building_status
=
False
if
requesting_student
.
get_building
==
self
.
get_object
().
get_building
:
building_status
=
True
return
building_status
if
onFloor
():
students
=
Student
.
objects
.
filter
(
room
=
self
.
get_object
()).
floor_building_students
()
...
...
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