Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Websites UFRPE
Wagtail Videos
Commits
1b40ac4e
Commit
1b40ac4e
authored
Feb 09, 2022
by
13hakta
Committed by
Vitaly Chekryzhev
Aug 03, 2022
Browse files
Retrieve collection for video index
parent
375d388c
Changes
1
Hide whitespace changes
Inline
Side-by-side
wagtailvideos/views/videos.py
View file @
1b40ac4e
...
@@ -33,7 +33,16 @@ permission_checker = PermissionPolicyChecker(permission_policy)
...
@@ -33,7 +33,16 @@ permission_checker = PermissionPolicyChecker(permission_policy)
def
index
(
request
):
def
index
(
request
):
# Get Videos (filtered by user permission)
# Get Videos (filtered by user permission)
Video
=
get_video_model
()
Video
=
get_video_model
()
videos
=
Video
.
objects
.
all
()
collections
=
permission_policy
.
collections_user_has_any_permission_for
(
request
.
user
,
[
'add'
,
'change'
,
'delete'
])
if
len
(
collections
)
>
1
:
collections_to_choose
=
collections
else
:
# no need to show a collections chooser
collections_to_choose
=
None
videos
=
Video
.
objects
.
filter
(
collection__in
=
collections
)
# Search
# Search
query_string
=
None
query_string
=
None
...
@@ -75,6 +84,7 @@ def index(request):
...
@@ -75,6 +84,7 @@ def index(request):
'search_form'
:
form
,
'search_form'
:
form
,
'popular_tags'
:
popular_tags_for_model
(
Video
),
'popular_tags'
:
popular_tags_for_model
(
Video
),
'current_collection'
:
current_collection
,
'current_collection'
:
current_collection
,
'collections'
:
collections_to_choose
,
})
})
return
response
return
response
...
...
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