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
a0cccfb0
Commit
a0cccfb0
authored
May 25, 2017
by
Daniel W Bond
Browse files
ras and rds will always be listed first on floor pages
parent
857b380d
Changes
1
Hide whitespace changes
Inline
Side-by-side
roomlist/housing/views.py
View file @
a0cccfb0
...
@@ -79,10 +79,17 @@ class DetailFloor(LoginRequiredMixin, DetailView):
...
@@ -79,10 +79,17 @@ class DetailFloor(LoginRequiredMixin, DetailView):
def
get_context_data
(
self
,
**
kwargs
):
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
DetailFloor
,
self
).
get_context_data
(
**
kwargs
)
context
=
super
(
DetailFloor
,
self
).
get_context_data
(
**
kwargs
)
requesting_student
=
Student
.
objects
.
get
(
user
=
self
.
request
.
user
)
requesting_student
=
self
.
request
.
user
.
student
students
=
Student
.
objects
.
visible
(
requesting_student
,
self
.
get_object
())
students
=
Student
.
objects
.
visible
(
requesting_student
,
self
.
get_object
())
# list RAs first
staff
=
[
student
for
student
in
students
if
student
.
is_staff
()]
for
s
in
staff
:
students
.
insert
(
0
,
students
.
pop
(
students
.
index
(
s
)))
context
[
'students'
]
=
shadowbanning
(
requesting_student
,
students
)
context
[
'students'
]
=
shadowbanning
(
requesting_student
,
students
)
# boolean values; helps cut down on if/else block complexity on the template
# boolean values; helps cut down on if/else block complexity on the template
context
[
'notOnFloor'
]
=
not
(
requesting_student
in
self
.
get_object
())
context
[
'notOnFloor'
]
=
not
(
requesting_student
in
self
.
get_object
())
...
@@ -113,7 +120,7 @@ class DetailRoom(LoginRequiredMixin, DetailView):
...
@@ -113,7 +120,7 @@ class DetailRoom(LoginRequiredMixin, DetailView):
def
get_context_data
(
self
,
**
kwargs
):
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
DetailRoom
,
self
).
get_context_data
(
**
kwargs
)
context
=
super
(
DetailRoom
,
self
).
get_context_data
(
**
kwargs
)
requesting_student
=
Student
.
objects
.
get
(
user
=
self
.
request
.
user
)
requesting_student
=
self
.
request
.
user
.
student
students
=
Student
.
objects
.
visible
(
requesting_student
,
self
.
get_object
())
students
=
Student
.
objects
.
visible
(
requesting_student
,
self
.
get_object
())
...
...
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