Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Maják
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
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
TO
Maják
Commits
d1b3113c
Commit
d1b3113c
authored
3 years ago
by
Ondrej Rehounek
Browse files
Options
Downloads
Patches
Plain Diff
district and region: Set ordering as '-last_published_at'
parent
8cbe1908
No related branches found
No related tags found
2 merge requests
!435
Release upgrades
,
!430
Feature/majak misc enhancements
Pipeline
#7043
passed
3 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
district/models.py
+10
-4
10 additions, 4 deletions
district/models.py
region/models.py
+10
-4
10 additions, 4 deletions
region/models.py
with
20 additions
and
8 deletions
district/models.py
+
10
−
4
View file @
d1b3113c
...
...
@@ -193,7 +193,13 @@ class DistrictHomePage(MetadataPageMixin, CalendarMixin, Page):
@property
def
articles
(
self
):
return
self
.
get_descendants
().
type
(
DistrictArticlePage
).
live
().
specific
()[:
6
]
return
(
self
.
get_descendants
()
.
type
(
DistrictArticlePage
)
.
live
()
.
specific
()
.
order_by
(
"
-last_published_at
"
)[:
6
]
)
@property
def
articles_page
(
self
):
...
...
@@ -271,7 +277,7 @@ class DistrictArticlePage(ArticleMixin, SubpageMixin, MetadataPageMixin, Page):
self
.
get_siblings
(
inclusive
=
False
)
.
live
()
# TODO? filtrovat na stejné tagy?
.
specific
()
.
order_by
(
"
-
uniwebarticlepage__d
at
e
"
)[:
3
]
.
order_by
(
"
-
last_published_
at
"
)[:
3
]
)
return
context
...
...
@@ -302,7 +308,7 @@ class DistrictArticlesPage(SubpageMixin, MetadataPageMixin, Page):
def
get_context
(
self
,
request
):
context
=
super
().
get_context
(
request
)
context
[
"
articles
"
]
=
Paginator
(
self
.
get_children
().
live
().
specific
(),
self
.
get_children
().
live
().
specific
()
.
order_by
(
"
-last_published_at
"
)
,
self
.
max_items
,
).
get_page
(
request
.
GET
.
get
(
"
page
"
))
return
context
...
...
@@ -388,7 +394,7 @@ class DistrictTagsPage(SubpageMixin, MetadataPageMixin, Page):
return
{
"
article_page_list
"
:
Paginator
(
article_page_qs
,
article_page_qs
.
order_by
(
"
-last_published_at
"
)
,
self
.
root_page
.
articles_page
.
max_items
,
).
get_page
(
request
.
GET
.
get
(
"
page
"
)),
"
tag
"
:
tag
,
...
...
This diff is collapsed.
Click to expand it.
region/models.py
+
10
−
4
View file @
d1b3113c
...
...
@@ -193,7 +193,13 @@ class RegionHomePage(MetadataPageMixin, CalendarMixin, Page):
@property
def
articles
(
self
):
return
self
.
get_descendants
().
type
(
RegionArticlePage
).
live
().
specific
()[:
6
]
return
(
self
.
get_descendants
()
.
type
(
RegionArticlePage
)
.
live
()
.
specific
()
.
order_by
(
"
-last_published_at
"
)[:
6
]
)
@property
def
articles_page
(
self
):
...
...
@@ -269,7 +275,7 @@ class RegionArticlePage(ArticleMixin, SubpageMixin, MetadataPageMixin, Page):
self
.
get_siblings
(
inclusive
=
False
)
.
live
()
.
specific
()
.
order_by
(
"
-
uniwebarticlepage__d
at
e
"
)[:
3
]
.
order_by
(
"
-
last_published_
at
"
)[:
3
]
)
return
context
...
...
@@ -300,7 +306,7 @@ class RegionArticlesPage(SubpageMixin, MetadataPageMixin, Page):
def
get_context
(
self
,
request
):
context
=
super
().
get_context
(
request
)
context
[
"
articles
"
]
=
Paginator
(
self
.
get_children
().
live
().
specific
(),
self
.
get_children
().
live
().
specific
()
.
order_by
(
"
-last_published_at
"
)
,
self
.
max_items
,
).
get_page
(
request
.
GET
.
get
(
"
page
"
))
return
context
...
...
@@ -386,7 +392,7 @@ class RegionTagsPage(SubpageMixin, MetadataPageMixin, Page):
return
{
"
article_page_list
"
:
Paginator
(
article_page_qs
,
article_page_qs
.
order_by
(
"
-last_published_at
"
)
,
self
.
root_page
.
articles_page
.
max_items
,
).
get_page
(
request
.
GET
.
get
(
"
page
"
)),
"
tag
"
:
tag
,
...
...
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