Commit 7ed5bd85 authored by delanoe's avatar delanoe

[FIX] Urls and views cleaned.

parent 8dca1faa
......@@ -7,5 +7,4 @@ urlpatterns = patterns('',
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])+(\+[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 ?
)
......@@ -15,7 +15,6 @@ from rest_framework.authentication import SessionAuthentication, BasicAuthentica
from node.models import Node
from gargantext_web.db import *
from ngram.lists import listIds, listNgramIds
from rest_v1_0.api import JsonHttpResponse
@login_required
......@@ -142,30 +141,6 @@ class NgramCreate(APIView):
'list_id': list_id,
})
def deleteMultiple(request, list_id):
results = ["hola","mundo"]
user = request.user
if not user.is_authenticated():
return redirect('/login/?next=%s' % request.path)
if request.POST:
todel_ids = json.loads(request.POST['to_delete'])
for ngram_id in todel_ids:
# add the ngram to the list if not already done
node_ngram = (session.query(Node_Ngram)
.filter(Node_Ngram.node_id==list_id)
.filter(Node_Ngram.ngram_id==ngram_id)
.first()
)
if node_ngram is None:
node_ngram = Node_Ngram(node_id=list_id, ngram_id=ngram_id, weight=1.0)
session.add(node_ngram)
session.commit()
return JsonHttpResponse(results)
class Document(APIView):
"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment