Commit 1ba4b32a authored by c24b's avatar c24b

FIX bug on Graph + languages imported

parent 2d363650
......@@ -152,7 +152,7 @@ INDEXED_HYPERDATA = {
}
# user parameters----------------------------------------
USER_LANG = ("fr", "en")
USER_LANG = ["fr", "en"]
# resources ---------------------------------------------
......
......@@ -6,6 +6,7 @@ from gargantext.constants import *
from gargantext.settings import *
from datetime import datetime
from .main import get_node_user
from gargantext.constants import USER_LANG
def _get_user_project_corpus(request, project_id, corpus_id):
"""Helper method to get a corpus, knowing the project's and corpus' ID.
......@@ -42,6 +43,7 @@ def docs_by_titles(request, project_id, corpus_id):
'view': 'titles',
'user': request.user,
'user_parameters': node_user.hyperdata,
'languages': USER_LANG
},
)
......@@ -73,7 +75,8 @@ def docs_by_sources(request, project_id, corpus_id):
'resourcename' : get_resource(source_type)['name'],
'user': request.user,
'user_parameters': node_user,
'view': 'sources'
'view': 'sources',
'USER_LANG': USER_LANG
},
)
......@@ -104,7 +107,8 @@ def docs_by_authors(request, project_id, corpus_id):
'resourcename' : get_resource(source_type)['name'],
'view': 'authors',
'user': request.user,
'user_parameters': node_user.hyperdata
'user_parameters': node_user.hyperdata,
'USER_LANG': USER_LANG
},
)
......@@ -129,6 +133,7 @@ def analytics(request, project_id, corpus_id):
'resourcename' : get_resource(source_type)['name'],
'view': 'analytics',
'user': request.user,
'user_parameters': node_user.hyperdata
'user_parameters': node_user.hyperdata,
'USER_LANG': USER_LANG
},
)
......@@ -3,6 +3,7 @@ from gargantext.util.db import session
from gargantext.models import Node, User
import datetime
from gargantext.util.generators import paragraphs, credits
from gargantext.constants import USER_LANG
def get_node_user(user):
#load user parameters from User(Node).hyperdata from request.user or cache.
......@@ -43,15 +44,15 @@ def home(request):
'paragraph_gargantua': paragraphs.gargantua(),
'paragraph_lorem' : paragraphs.lorem(),
'paragraph_tutoreil': paragraphs.tutoreil(),
'user_parameters': user_node.hyperdata
'user_parameters': user_node.hyperdata,
'languages': USER_LANG,
},
)
def about(request):
'''About Gargantext, its team and sponsors
'''
user_node = get_user_node(request.user)
user_node = get_node_user(request.user)
return render(
template_name = 'pages/main/about.html',
request = request,
......@@ -62,7 +63,8 @@ def about(request):
'institutions': credits.institutions(),
'labos': credits.labs(),
'grants': credits.grants(),
'user_parameters': user_node.hyperdata
'user_parameters': user_node.hyperdata,
'languages': USER_LANG,
},
)
......
......@@ -4,6 +4,7 @@ from gargantext.util.db_cache import cache
from gargantext.util.files import upload
from gargantext.models import *
from gargantext.constants import *
from gargantext.constants import USER_LANG
from .main import get_node_user
from gargantext.util.scheduling import scheduled
from gargantext.util.toolchain import parse_extract_indexhyperdata
......@@ -68,6 +69,7 @@ def overview(request):
'number': user_projects.count(),
'projects': user_projects,
"user_parameters":node_user.hyperdata,
'USER_LANG': USER_LANG,
# projects owned by the user's contacts
'common_users': (contact for contact, projects in contacts_projects),
'common_projects': sum((projects for contact, projects in contacts_projects), []),
......@@ -190,6 +192,7 @@ def project(request, project_id):
'form': NewCorpusForm,
'user': request.user,
"user_parameters":node_user.hyperdata,
'languages': USER_LANG,
'date': datetime.now(),
'project': project,
'donut': donut,
......
......@@ -3,6 +3,7 @@ from gargantext.util.db import session
from gargantext.util.db_cache import cache
from gargantext.models import Node
from gargantext.constants import get_resource
from gargantext.constants import USER_LANG
from .main import get_node_user
from datetime import datetime
......@@ -51,6 +52,8 @@ def ngramtable(request, project_id, corpus_id):
# for the CSV import modal
'importroute': "/api/ngramlists/import?onto_corpus=%i"% corpus.id,
'corporainfos' : corpora_infos,
#user params
'user_parameters': user_node.hyperdata,
'USER_LANG': USER_LANG
},
)
......@@ -4,9 +4,9 @@ from gargantext.util.db_cache import cache
from gargantext.models import *
from gargantext.constants import *
from gargantext.settings import *
from gargantext.views.pages.main import get_node_user
from gargantext.constants import USER_LANG
from datetime import datetime
from gargantext.views.pages.main import get_node_user
@requires_auth
def explorer(request, project_id, corpus_id):
......@@ -49,6 +49,7 @@ def explorer(request, project_id, corpus_id):
'maplist_id': maplist_id ,
'view' : 'graph' ,
'user_parameters': node_user.hyperdata,
'USER_LANG': USER_LANG
},
)
......@@ -64,7 +65,7 @@ def myGraphs(request, project_id, corpus_id):
'''
user = cache.User[request.user.id]
node_user = get_node_user(user)
user_node = get_node_user(user)
# we pass our corpus
corpus = cache.Node[corpus_id]
......@@ -105,5 +106,6 @@ def myGraphs(request, project_id, corpus_id):
'coocs' : coocs,
'coocs_count' : coocs_count,
'user_parameters': user_node.hyperdata,
'languages': USER_LANG,
},
)
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