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
b126fd14
Commit
b126fd14
authored
Oct 04, 2016
by
Daniel W Bond
Browse files
major sorting now filters through a list of majors instead of lookup with a single object
parent
ef7ab00e
Changes
1
Hide whitespace changes
Inline
Side-by-side
roomlist/accounts/views.py
View file @
b126fd14
...
@@ -278,7 +278,7 @@ class DetailMajor(LoginRequiredMixin, DetailView):
...
@@ -278,7 +278,7 @@ class DetailMajor(LoginRequiredMixin, DetailView):
rooms
=
[
rooms
=
[
room
room
for
room
in
Room
.
objects
.
filter
(
floor__building__neighbourhood
=
neighbourhood
)
for
room
in
Room
.
objects
.
filter
(
floor__building__neighbourhood
=
neighbourhood
)
if
room
.
student_set
.
filter
(
major
=
self
.
get_object
())
if
room
.
student_set
.
filter
(
major
__in
=
[
self
.
get_object
()
]
)
]
]
# identify if the student(s) in that room are visible to the requesting student
# identify if the student(s) in that room are visible to the requesting student
...
@@ -294,7 +294,7 @@ class DetailMajor(LoginRequiredMixin, DetailView):
...
@@ -294,7 +294,7 @@ class DetailMajor(LoginRequiredMixin, DetailView):
])),
key
=
attrgetter
(
'user.username'
))
])),
key
=
attrgetter
(
'user.username'
))
# see what students are left over (aren't visible)
# see what students are left over (aren't visible)
hidden
=
set
(
Student
.
objects
.
filter
(
major
=
self
.
get_object
()).
order_by
(
'user__username'
))
hidden
=
set
(
Student
.
objects
.
filter
(
major
__in
=
[
self
.
get_object
()
]
).
order_by
(
'user__username'
))
# print(hidden)
# print(hidden)
for
visible
in
visible_by_neighbourhood
.
values
():
for
visible
in
visible_by_neighbourhood
.
values
():
# print('visible', visible)
# print('visible', visible)
...
...
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