Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nk20
Manage
Activity
Members
Labels
Plan
Issues
32
Issue boards
Milestones
Wiki
Code
Merge requests
6
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BDE
nk20
Commits
f567b1a3
Commit
f567b1a3
authored
4 years ago
by
ynerant
Browse files
Options
Downloads
Patches
Plain Diff
Activity list is displayed in the right order
parent
155b2df3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!82
Beta soon
Pipeline
#8209
passed with warnings with stages
in 4 minutes and 30 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
apps/activity/views.py
+4
-4
4 additions, 4 deletions
apps/activity/views.py
apps/permission/views.py
+1
-1
1 addition, 1 deletion
apps/permission/views.py
with
5 additions
and
5 deletions
apps/activity/views.py
+
4
−
4
View file @
f567b1a3
...
@@ -36,9 +36,7 @@ class ActivityCreateView(ProtectQuerysetMixin, LoginRequiredMixin, CreateView):
...
@@ -36,9 +36,7 @@ class ActivityCreateView(ProtectQuerysetMixin, LoginRequiredMixin, CreateView):
class
ActivityListView
(
ProtectQuerysetMixin
,
LoginRequiredMixin
,
SingleTableView
):
class
ActivityListView
(
ProtectQuerysetMixin
,
LoginRequiredMixin
,
SingleTableView
):
model
=
Activity
model
=
Activity
table_class
=
ActivityTable
table_class
=
ActivityTable
ordering
=
(
'
-date_start
'
,)
def
get_queryset
(
self
):
return
super
().
get_queryset
().
reverse
()
def
get_context_data
(
self
,
**
kwargs
):
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
().
get_context_data
(
**
kwargs
)
context
=
super
().
get_context_data
(
**
kwargs
)
...
@@ -47,7 +45,9 @@ class ActivityListView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableView
...
@@ -47,7 +45,9 @@ class ActivityListView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableView
upcoming_activities
=
Activity
.
objects
.
filter
(
date_end__gt
=
datetime
.
now
())
upcoming_activities
=
Activity
.
objects
.
filter
(
date_end__gt
=
datetime
.
now
())
context
[
'
upcoming
'
]
=
ActivityTable
(
context
[
'
upcoming
'
]
=
ActivityTable
(
data
=
upcoming_activities
.
filter
(
PermissionBackend
.
filter_queryset
(
self
.
request
.
user
,
Activity
,
"
view
"
)))
data
=
upcoming_activities
.
filter
(
PermissionBackend
.
filter_queryset
(
self
.
request
.
user
,
Activity
,
"
view
"
)),
prefix
=
'
upcoming-
'
,
)
return
context
return
context
...
...
This diff is collapsed.
Click to expand it.
apps/permission/views.py
+
1
−
1
View file @
f567b1a3
...
@@ -19,7 +19,7 @@ class ProtectQuerysetMixin:
...
@@ -19,7 +19,7 @@ class ProtectQuerysetMixin:
"""
"""
def
get_queryset
(
self
,
**
kwargs
):
def
get_queryset
(
self
,
**
kwargs
):
qs
=
super
().
get_queryset
(
**
kwargs
)
qs
=
super
().
get_queryset
(
**
kwargs
)
return
qs
.
filter
(
PermissionBackend
.
filter_queryset
(
self
.
request
.
user
,
qs
.
model
,
"
view
"
))
return
qs
.
filter
(
PermissionBackend
.
filter_queryset
(
self
.
request
.
user
,
qs
.
model
,
"
view
"
))
.
distinct
()
def
get_form
(
self
,
form_class
=
None
):
def
get_form
(
self
,
form_class
=
None
):
form
=
super
().
get_form
(
form_class
)
form
=
super
().
get_form
(
form_class
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment