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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TO
Maják
Commits
fda46db5
Verified
Commit
fda46db5
authored
Jul 16, 2023
by
jindra12
Browse files
Options
Downloads
Patches
Plain Diff
Finish district articles page
#210
parent
fcbeb44c
Branches
Branches containing commit
No related tags found
2 merge requests
!816
Release
,
!801
Prepare basic shared tags
Pipeline
#13789
passed
Jul 16, 2023
Stage: build
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
district/models.py
+7
-6
7 additions, 6 deletions
district/models.py
shared/models.py
+7
-6
7 additions, 6 deletions
shared/models.py
with
14 additions
and
12 deletions
district/models.py
+
7
−
6
View file @
fda46db5
...
@@ -585,7 +585,7 @@ class DistrictArticlesPage(
...
@@ -585,7 +585,7 @@ class DistrictArticlesPage(
tag
=
None
tag
=
None
try
:
try
:
tag
=
Tag
.
objects
.
filter
(
tag__
slug
=
request
.
GET
[
"
tag
"
])[
0
]
.
tag
tag
=
Tag
.
objects
.
filter
(
slug
=
request
.
GET
[
"
tag
"
])[
0
]
article_page_qs
=
self
.
append_all_shared_articles
(
article_page_qs
=
self
.
append_all_shared_articles
(
DistrictArticlePage
.
objects
.
filter
(
DistrictArticlePage
.
objects
.
filter
(
id__in
=
site_article_ids
,
tags__slug
=
tag
.
slug
id__in
=
site_article_ids
,
tags__slug
=
tag
.
slug
...
@@ -603,7 +603,7 @@ class DistrictArticlesPage(
...
@@ -603,7 +603,7 @@ class DistrictArticlesPage(
return
{
return
{
"
article_page_list
"
:
Paginator
(
"
article_page_list
"
:
Paginator
(
article_page_qs
.
order_by
(
"
-date
"
)
,
article_page_qs
,
self
.
max_items
,
self
.
max_items
,
).
get_page
(
request
.
GET
.
get
(
"
page
"
)),
).
get_page
(
request
.
GET
.
get
(
"
page
"
)),
"
tag
"
:
tag
,
"
tag
"
:
tag
,
...
@@ -616,10 +616,11 @@ class DistrictArticlesPage(
...
@@ -616,10 +616,11 @@ class DistrictArticlesPage(
"""
"""
return
self
.
search_tags_by_article_id
(
return
self
.
search_tags_by_article_id
(
site_article_ids
,
site_article_ids
,
additional_query
=
lambda
query
:
query
.
annotate
(
count
=
models
.
Count
(
"
slug
"
)),
custom_query_to_values
=
lambda
query
:
query
.
annotate
(
custom_query_to_values
=
lambda
query
:
query
.
order_by
(
"
slug
"
).
values
(
count
=
models
.
Count
(
"
slug
"
)
"
name
"
,
"
slug
"
,
"
count
"
)
),
.
order_by
(
"
slug
"
)
.
values
(
"
name
"
,
"
slug
"
,
"
count
"
),
)
)
...
...
This diff is collapsed.
Click to expand it.
shared/models.py
+
7
−
6
View file @
fda46db5
...
@@ -465,7 +465,7 @@ class ArticlesMixin(models.Model):
...
@@ -465,7 +465,7 @@ class ArticlesMixin(models.Model):
self
,
previous_query
:
models
.
QuerySet
|
None
=
None
,
filter
=
None
self
,
previous_query
:
models
.
QuerySet
|
None
=
None
,
filter
=
None
):
):
results
=
self
.
append_all_shared_articles_query
(
previous_query
,
filter
)
results
=
self
.
append_all_shared_articles_query
(
previous_query
,
filter
)
return
results
.
values_list
(
"
id
"
,
F
lat
=
True
)
return
results
.
values_list
(
"
id
"
,
f
lat
=
True
)
def
append_all_shared_articles
(
def
append_all_shared_articles
(
self
,
previous_query
:
models
.
QuerySet
|
None
=
None
,
filter
=
None
self
,
previous_query
:
models
.
QuerySet
|
None
=
None
,
filter
=
None
...
@@ -557,12 +557,13 @@ class ArticlesMixin(models.Model):
...
@@ -557,12 +557,13 @@ class ArticlesMixin(models.Model):
union
=
district_tags
.
union
(
uniweb_tags
).
union
(
main_tags
)
union
=
district_tags
.
union
(
uniweb_tags
).
union
(
main_tags
)
if
custom_query_to_values
is
not
None
:
union
=
custom_query_to_values
(
union
)
return
union
else
:
union
=
union
.
values_list
(
"
id
"
)
union
=
union
.
values_list
(
"
id
"
)
return
Tag
.
objects
.
filter
(
id__in
=
union
)
tag_query
=
Tag
.
objects
.
filter
(
id__in
=
union
)
if
custom_query_to_values
is
not
None
:
tag_query
=
custom_query_to_values
(
tag_query
)
return
tag_query
def
search_tags_by_tag_name
(
self
,
tag
:
str
):
def
search_tags_by_tag_name
(
self
,
tag
:
str
):
return
{
return
{
...
...
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