Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
rp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
15
Issues
15
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
La Quadrature du Net
rpteam
rp
Commits
3b154331
Commit
3b154331
authored
Apr 04, 2019
by
Okhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The tag part was broken, it now correctly get distinct and non empty tags, creating all of them
parent
c88a161b
Pipeline
#2547
passed with stages
in 2 minutes and 53 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
apps/core/management/commands/import_old_rp.py
apps/core/management/commands/import_old_rp.py
+3
-3
No files found.
apps/core/management/commands/import_old_rp.py
View file @
3b154331
...
...
@@ -40,14 +40,14 @@ class Command(BaseCommand):
c
=
db
.
cursor
(
DictCursor
)
# First, let's get the data from presse table.
# We're also grouping a lot of queries
presse
=
c
.
execute
(
"""SELECT *, nr.body as body, GROUP_CONCAT(
t.name, ','
) as tags
presse
=
c
.
execute
(
"""SELECT *, nr.body as body, GROUP_CONCAT(
DISTINCT t.name
) as tags
FROM presse p
JOIN node n
ON n.nid = p.nid
JOIN node_revisions nr
ON nr.vid = n.vid
JOIN term_node tn
ON tn.
nid = p.n
id
ON tn.
vid = n.v
id
JOIN term_data t
ON t.tid = tn.tid
GROUP BY n.nid"""
)
...
...
@@ -81,7 +81,7 @@ class Command(BaseCommand):
article
.
refresh_from_db
()
# Insert tags
article
.
tags
.
add
(
item
[
'tags'
].
lower
(
))
article
.
tags
.
set
(
*
item
[
'tags'
].
lower
().
split
(
','
))
# Publish or draft as needed
if
item
[
'published'
]
>=
1
:
# Let's get the extracts
...
...
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