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
4e32d85c
Unverified
Commit
4e32d85c
authored
Aug 16, 2022
by
Seb Brown
Committed by
GitHub
Aug 16, 2022
Browse files
Merge pull request #92 from 13hakta/collection
Retrieve collection for video index
parents
375d388c
1b40ac4e
Changes
1
Hide whitespace changes
Inline
Side-by-side
wagtailvideos/views/videos.py
View file @
4e32d85c
...
...
@@ -33,7 +33,16 @@ permission_checker = PermissionPolicyChecker(permission_policy)
def
index
(
request
):
# Get Videos (filtered by user permission)
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
query_string
=
None
...
...
@@ -75,6 +84,7 @@ def index(request):
'search_form'
:
form
,
'popular_tags'
:
popular_tags_for_model
(
Video
),
'current_collection'
:
current_collection
,
'collections'
:
collections_to_choose
,
})
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