Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
MOOC packages by hacklab
django-courses
Commits
f943f463
Commit
f943f463
authored
May 11, 2021
by
Matheus Miranda
Browse files
Filter courses by language
parent
713162b0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
courses/views.py
courses/views.py
+3
-1
No files found.
courses/views.py
View file @
f943f463
...
...
@@ -68,7 +68,9 @@ class CourseViewSet(viewsets.ModelViewSet):
# Q(is_public=True, ) | Q(groups__in=self.request.user.groups.all(), status='published')
# )
#)
query
=
Q
(
status
=
'published'
)
from
django.utils.translation
import
get_language
current_language
=
get_language
()
query
=
Q
(
status
=
'published'
,
lang__contains
=
[
current_language
])
if
(
CourseProfessor
.
objects
.
filter
(
user
=
self
.
request
.
user
,
role
=
'coordinator'
).
exists
()):
query
.
add
(
Q
(
...
...
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