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
ce5bdf7d
Verified
Commit
ce5bdf7d
authored
1 year ago
by
jindra12
Browse files
Options
Downloads
Patches
Plain Diff
Creates fake pages based on query
#210
parent
751e2fa0
No related branches found
No related tags found
2 merge requests
!816
Release
,
!801
Prepare basic shared tags
Pipeline
#13765
passed
1 year ago
Stage: build
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
shared/models.py
+7
-7
7 additions, 7 deletions
shared/models.py
with
7 additions
and
7 deletions
shared/models.py
+
7
−
7
View file @
ce5bdf7d
...
...
@@ -296,8 +296,8 @@ class ArticlesMixin(models.Model):
fields_reducer
=
(
lambda
assigned
,
field
:
assigned
if
field
.
name
is
"
shared
"
else
assigned
|
{
f
"
union_
{
field
.
name
}
"
:
F
(
field
.
name
)}
if
field
.
column
==
"
shared
"
else
assigned
|
{
f
"
union_
{
field
.
column
}
"
:
F
(
field
.
column
)}
)
setup_fields_order
=
lambda
orderBy
,
orderFrom
:
reduce
(
lambda
orderTo
,
field
:
orderTo
|
{
f
"
{
field
}
"
:
orderFrom
[
field
]},
...
...
@@ -306,7 +306,7 @@ class ArticlesMixin(models.Model):
)
main_fields
=
reduce
(
fields_reducer
,
main_meta_fields
,
{})
|
{
"
union_thumb_image
"
:
F
(
"
search_image
"
),
"
union_thumb_image
_id
"
:
F
(
"
search_image
_id
"
),
}
district_fields
=
setup_fields_order
(
...
...
@@ -322,7 +322,7 @@ class ArticlesMixin(models.Model):
main_fields
,
reduce
(
fields_reducer
,
uniweb_meta_fields
,
{})
|
{
"
union_author_page
"
:
Value
(
"
union_author_page
_id
"
:
Value
(
None
,
output_field
=
models
.
ForeignKey
(
DistrictArticlePage
,
blank
=
True
,
on_delete
=
models
.
SET_NULL
...
...
@@ -331,7 +331,7 @@ class ArticlesMixin(models.Model):
"
union_region
"
:
Value
(
""
,
models
.
CharField
()),
"
union_article_type
"
:
Value
(
0
,
models
.
PositiveSmallIntegerField
()),
"
union_is_black
"
:
Value
(
False
,
models
.
BooleanField
()),
"
union_thumb_image
"
:
F
(
"
search_image
"
),
"
union_thumb_image
_id
"
:
F
(
"
search_image
_id
"
),
},
)
...
...
@@ -420,13 +420,13 @@ class ArticlesMixin(models.Model):
)
# We MUST eval here since we can't turn values() into concrete class instances in QuerySet after union
assign_to_model
=
lambda
unioned
:
lambda
assignment
,
field
:
assignment
|
{
field
.
name
:
unioned
[
f
"
union_
{
field
.
name
}
"
]
field
.
column
:
unioned
[
f
"
union_
{
field
.
column
}
"
]
}
if
isinstance
(
self
,
DistrictArticlesPage
):
return
list
(
map
(
lambda
unioned
:
DistrictArticlePage
.
objects
.
create
(
lambda
unioned
:
DistrictArticlePage
(
**
reduce
(
assign_to_model
(
unioned
),
district_meta_fields
,
{})
),
evaluated
,
...
...
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