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
97ca8f84
Commit
97ca8f84
authored
Oct 25, 2016
by
c24b
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BACK access user params
parent
0987d3ee
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
7 deletions
+11
-7
users.py
gargantext/models/users.py
+1
-1
corpora.py
gargantext/views/pages/corpora.py
+1
-1
projects.py
gargantext/views/pages/projects.py
+9
-5
No files found.
gargantext/models/users.py
View file @
97ca8f84
gargantext/views/pages/corpora.py
View file @
97ca8f84
...
@@ -82,7 +82,7 @@ def docs_by_sources(request, project_id, corpus_id):
...
@@ -82,7 +82,7 @@ def docs_by_sources(request, project_id, corpus_id):
'corpus'
:
corpus
,
'corpus'
:
corpus
,
'resourcename'
:
get_resource
(
source_type
)[
'name'
],
'resourcename'
:
get_resource
(
source_type
)[
'name'
],
'user'
:
request
.
user
,
'user'
:
request
.
user
,
'user_parameters'
:
get_node_user
(
user
)[
"hyperdata"
]
'user_parameters'
:
get_node_user
(
user
)[
"hyperdata"
]
,
'view'
:
'sources'
'view'
:
'sources'
},
},
)
)
...
...
gargantext/views/pages/projects.py
View file @
97ca8f84
...
@@ -14,9 +14,12 @@ from django.utils.translation import ugettext_lazy
...
@@ -14,9 +14,12 @@ from django.utils.translation import ugettext_lazy
import
re
import
re
def
get_node_user
(
user
):
def
get_node_user
(
user
):
node_user
=
session
.
query
(
Node
)
.
filter
(
Node
.
user_id
==
user
.
id
&
Node
.
typename
==
"USER"
)
node_user
=
session
.
query
(
Node
)
.
filter
(
Node
.
user_id
==
user
.
id
,
Node
.
typename
==
"USER"
)
.
first
(
)
if
node_user
is
None
:
if
node_user
is
None
:
node_user
=
Node
(
typename
==
"USER"
,
user_id
=
user
.
id
,
name
=
user
.
name
)
node_user
=
Node
(
user_id
=
user
.
id
,
typename
=
'USER'
,
# username = user.name,
)
#default language for now is 'fr'
#default language for now is 'fr'
node_user
.
hyperdata
[
"language"
]
=
"fr"
node_user
.
hyperdata
[
"language"
]
=
"fr"
session
.
add
(
node_user
)
session
.
add
(
node_user
)
...
@@ -31,6 +34,7 @@ def overview(request):
...
@@ -31,6 +34,7 @@ def overview(request):
'''
'''
user
=
cache
.
User
[
request
.
user
.
id
]
user
=
cache
.
User
[
request
.
user
.
id
]
print
(
user
)
node_user
=
get_node_user
(
user
)
node_user
=
get_node_user
(
user
)
# If POST method, creates a new project...
# If POST method, creates a new project...
if
request
.
method
==
'POST'
:
if
request
.
method
==
'POST'
:
...
@@ -62,7 +66,7 @@ def overview(request):
...
@@ -62,7 +66,7 @@ def overview(request):
# projects owned by the user
# projects owned by the user
'number'
:
user_projects
.
count
(),
'number'
:
user_projects
.
count
(),
'projects'
:
user_projects
,
'projects'
:
user_projects
,
"user_parameters"
:
node_user
[
"hyperdata"
]
,
"user_parameters"
:
node_user
.
hyperdata
,
# projects owned by the user's contacts
# projects owned by the user's contacts
'common_users'
:
(
contact
for
contact
,
projects
in
contacts_projects
),
'common_users'
:
(
contact
for
contact
,
projects
in
contacts_projects
),
'common_projects'
:
sum
((
projects
for
contact
,
projects
in
contacts_projects
),
[]),
'common_projects'
:
sum
((
projects
for
contact
,
projects
in
contacts_projects
),
[]),
...
@@ -184,7 +188,7 @@ def project(request, project_id):
...
@@ -184,7 +188,7 @@ def project(request, project_id):
'form'
:
NewCorpusForm
,
'form'
:
NewCorpusForm
,
'user'
:
request
.
user
,
'user'
:
request
.
user
,
"user_parameters"
:
node_user
[
"hyperdata"
]
,
"user_parameters"
:
node_user
.
hyperdata
,
'date'
:
datetime
.
now
(),
'date'
:
datetime
.
now
(),
'project'
:
project
,
'project'
:
project
,
'donut'
:
donut
,
'donut'
:
donut
,
...
@@ -204,7 +208,7 @@ def project(request, project_id):
...
@@ -204,7 +208,7 @@ def project(request, project_id):
template_name
=
'pages/projects/project.html'
,
template_name
=
'pages/projects/project.html'
,
request
=
request
,
request
=
request
,
context
=
{
context
=
{
"user_parameters"
:
node_user
[
"hyperdata"
]
,
"user_parameters"
:
node_user
.
hyperdata
,
'form'
:
NewCorpusForm
,
'form'
:
NewCorpusForm
,
'user'
:
request
.
user
,
'user'
:
request
.
user
,
'date'
:
datetime
.
now
(),
'date'
:
datetime
.
now
(),
...
...
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