Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
a8ac5d0d
Commit
a8ac5d0d
authored
Mar 15, 2015
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] toward new orm on api.py
parent
a7013097
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
api.py
gargantext_web/api.py
+3
-2
No files found.
gargantext_web/api.py
View file @
a8ac5d0d
...
@@ -187,6 +187,7 @@ class NodesChildrenDuplicates(APIView):
...
@@ -187,6 +187,7 @@ class NodesChildrenDuplicates(APIView):
# get the minimum ID for each of the nodes sharing the same metadata
# get the minimum ID for each of the nodes sharing the same metadata
kept_node_ids_query
=
self
.
_fetch_duplicates
(
request
,
node_id
,
[
func
.
min
(
Node
.
id
)
.
label
(
'id'
)],
0
)
kept_node_ids_query
=
self
.
_fetch_duplicates
(
request
,
node_id
,
[
func
.
min
(
Node
.
id
)
.
label
(
'id'
)],
0
)
kept_node_ids
=
[
kept_node
.
id
for
kept_node
in
kept_node_ids_query
]
kept_node_ids
=
[
kept_node
.
id
for
kept_node
in
kept_node_ids_query
]
# TODO with new orm
duplicate_nodes
=
models
.
Node
.
objects
.
filter
(
parent_id
=
node_id
)
.
exclude
(
id__in
=
kept_node_ids
)
duplicate_nodes
=
models
.
Node
.
objects
.
filter
(
parent_id
=
node_id
)
.
exclude
(
id__in
=
kept_node_ids
)
# # delete the stuff
# # delete the stuff
# delete_query = (session
# delete_query = (session
...
@@ -585,7 +586,7 @@ class Nodes(APIView):
...
@@ -585,7 +586,7 @@ class Nodes(APIView):
# it should take the subnodes into account as well,
# it should take the subnodes into account as well,
# for better constistency...
# for better constistency...
def
delete
(
self
,
request
,
node_id
):
def
delete
(
self
,
request
,
node_id
):
node
=
models
.
Node
.
objects
.
filter
(
id
=
node_id
)
node
=
session
.
query
(
Node
)
.
filter
(
Node
.
id
==
node_id
)
.
first
(
)
msgres
=
""
msgres
=
""
try
:
try
:
node
.
delete
()
node
.
delete
()
...
@@ -605,7 +606,7 @@ class CorpusController:
...
@@ -605,7 +606,7 @@ class CorpusController:
corpus_id
=
int
(
corpus_id
)
corpus_id
=
int
(
corpus_id
)
except
:
except
:
raise
ValidationError
(
'Corpora are identified by an integer.'
,
400
)
raise
ValidationError
(
'Corpora are identified by an integer.'
,
400
)
corpusQuery
=
Node
.
objects
.
filter
(
id
=
corpus_id
)
corpusQuery
=
session
.
query
(
Node
)
.
filter
(
Node
.
id
==
corpus_id
)
.
first
(
)
# print(str(corpusQuery))
# print(str(corpusQuery))
# raise Http404("C'est toujours ça de pris.")
# raise Http404("C'est toujours ça de pris.")
if
not
corpusQuery
:
if
not
corpusQuery
:
...
...
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