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
8dca1faa
Commit
8dca1faa
authored
Oct 15, 2015
by
delanoe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] url list for ngrams.
parent
cbfe3da3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
urls.py
annotations/urls.py
+1
-1
views.py
annotations/views.py
+3
-2
No files found.
annotations/urls.py
View file @
8dca1faa
...
...
@@ -5,7 +5,7 @@ from annotations import views
urlpatterns
=
patterns
(
''
,
url
(
r'^document/(?P<doc_id>[0-9]+)$'
,
views
.
Document
.
as_view
()),
# document view
url
(
r'^corpus/(?P<corpus_id>[0-9]+)/document/(?P<doc_id>[0-9]+)$'
,
views
.
NgramList
.
as_view
()),
# the list associated with an ngram
url
(
r'^lists/(?P<list_id>[0-9]+)/ngrams/(?P<ngram_id
>[0-9]+
)$'
,
views
.
NgramEdit
.
as_view
()),
#
url
(
r'^lists/(?P<list_id>[0-9]+)/ngrams/(?P<ngram_id
s>(([0-9])+(\+[0-9]+)*
)$'
,
views
.
NgramEdit
.
as_view
()),
#
url
(
r'^lists/(?P<list_id>[0-9]+)/ngrams/create$'
,
views
.
NgramCreate
.
as_view
()),
#
url
(
r'^lists/(?P<list_id>[0-9]+)/multiple?$'
,
views
.
deleteMultiple
),
# FIXME What's this ?
)
annotations/views.py
View file @
8dca1faa
...
...
@@ -72,7 +72,7 @@ class NgramEdit(APIView):
# TODO remove the node_ngram from another conflicting list
# FIXME session.query(Node_Ngram).filter(Node_Ngram.ngram_id==ngram_id).delete()
# add the ngram to the list
for
ngram_id
in
ngram_ids
:
for
ngram_id
in
ngram_ids
.
split
(
'+'
)
:
ngram_id
=
int
(
ngram_id
)
node_ngram
=
Node_Ngram
(
node_id
=
list_id
,
ngram_id
=
ngram_id
,
weight
=
1.0
)
session
.
add
(
node_ngram
)
...
...
@@ -89,7 +89,8 @@ class NgramEdit(APIView):
"""
Delete a ngram from a list
"""
for
ngram_id
in
ngram_ids
:
for
ngram_id
in
ngram_ids
.
split
(
'+'
):
ngram_id
=
int
(
ngram_id
)
(
session
.
query
(
Node_Ngram
)
.
filter
(
Node_Ngram
.
node_id
==
list_id
)
.
filter
(
Node_Ngram
.
ngram_id
==
ngram_id
)
.
delete
()
...
...
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