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
ca20590a
Commit
ca20590a
authored
Dec 16, 2015
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] correction import oublié dans annotations.views.NgramCreate
parent
90bbffd7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
urls.py
annotations/urls.py
+6
-0
views.py
annotations/views.py
+4
-1
No files found.
annotations/urls.py
View file @
ca20590a
...
@@ -2,9 +2,15 @@ from django.conf.urls import patterns, url
...
@@ -2,9 +2,15 @@ from django.conf.urls import patterns, url
from
annotations
import
views
from
annotations
import
views
# /!\ urls patterns here are *without* the trailing slash
urlpatterns
=
patterns
(
''
,
urlpatterns
=
patterns
(
''
,
# json:title,id,authors,journal,
# publication_date
# abstract_text,full_text
url
(
r'^document/(?P<doc_id>[0-9]+)$'
,
views
.
Document
.
as_view
()),
# document view
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'^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_ids>[0-9,\+]+)+$'
,
views
.
NgramEdit
.
as_view
()),
url
(
r'^lists/(?P<list_id>[0-9]+)/ngrams/(?P<ngram_ids>[0-9,\+]+)+$'
,
views
.
NgramEdit
.
as_view
()),
# POST (fixed 2015-12-16)
url
(
r'^lists/(?P<list_id>[0-9]+)/ngrams/create$'
,
views
.
NgramCreate
.
as_view
()),
#
url
(
r'^lists/(?P<list_id>[0-9]+)/ngrams/create$'
,
views
.
NgramCreate
.
as_view
()),
#
)
)
annotations/views.py
View file @
ca20590a
...
@@ -13,7 +13,7 @@ from rest_framework.exceptions import APIException
...
@@ -13,7 +13,7 @@ from rest_framework.exceptions import APIException
from
rest_framework.authentication
import
SessionAuthentication
,
BasicAuthentication
from
rest_framework.authentication
import
SessionAuthentication
,
BasicAuthentication
from
node.models
import
Node
from
node.models
import
Node
from
gargantext_web.db
import
session
,
cache
,
Node
,
NodeNgram
from
gargantext_web.db
import
session
,
cache
,
Node
,
NodeNgram
,
Ngram
from
ngram.lists
import
listIds
,
listNgramIds
from
ngram.lists
import
listIds
,
listNgramIds
from
gargantext_web.db
import
get_or_create_node
from
gargantext_web.db
import
get_or_create_node
...
@@ -138,6 +138,8 @@ class NgramCreate(APIView):
...
@@ -138,6 +138,8 @@ class NgramCreate(APIView):
def
post
(
self
,
request
,
list_id
):
def
post
(
self
,
request
,
list_id
):
"""
"""
create NGram in a given list
create NGram in a given list
example: request.data = {'text': 'phylogeny'}
"""
"""
list_id
=
int
(
list_id
)
list_id
=
int
(
list_id
)
# format the ngram's text
# format the ngram's text
...
@@ -161,6 +163,7 @@ class NgramCreate(APIView):
...
@@ -161,6 +163,7 @@ class NgramCreate(APIView):
ngram_id
=
ngram
.
id
ngram_id
=
ngram
.
id
# create the new node_ngram relation
# create the new node_ngram relation
# TODO check existing Node_Ngram ?
# TODO check existing Node_Ngram ?
# £TODO ici indexation
node_ngram
=
NodeNgram
(
node_id
=
list_id
,
ngram_id
=
ngram_id
,
weight
=
1.0
)
node_ngram
=
NodeNgram
(
node_id
=
list_id
,
ngram_id
=
ngram_id
,
weight
=
1.0
)
session
.
add
(
node_ngram
)
session
.
add
(
node_ngram
)
session
.
commit
()
session
.
commit
()
...
...
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