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
305f6466
Commit
305f6466
authored
Mar 18, 2015
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CLEAN]
parent
3175b571
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
4 deletions
+8
-4
api.py
gargantext_web/api.py
+1
-1
views_optimized.py
gargantext_web/views_optimized.py
+4
-1
models.py
node/models.py
+2
-1
test_db.py
test_db.py
+1
-1
No files found.
gargantext_web/api.py
View file @
305f6466
...
@@ -11,7 +11,7 @@ from sqlalchemy import text, distinct
...
@@ -11,7 +11,7 @@ from sqlalchemy import text, distinct
from
sqlalchemy.sql
import
func
from
sqlalchemy.sql
import
func
from
sqlalchemy.orm
import
aliased
from
sqlalchemy.orm
import
aliased
import
json
import
json
field
from
.db
import
*
from
.db
import
*
...
...
gargantext_web/views_optimized.py
View file @
305f6466
...
@@ -87,10 +87,12 @@ def project(request, project_id):
...
@@ -87,10 +87,12 @@ def project(request, project_id):
# form validation
# form validation
form
=
CustomForm
(
request
.
POST
,
request
.
FILES
)
form
=
CustomForm
(
request
.
POST
,
request
.
FILES
)
if
form
.
is_valid
():
if
form
.
is_valid
():
# extract information from the form
# extract information from the form
name
=
form
.
cleaned_data
[
'name'
]
name
=
form
.
cleaned_data
[
'name'
]
thefile
=
form
.
cleaned_data
[
'file'
]
thefile
=
form
.
cleaned_data
[
'file'
]
resourcetype
=
cache
.
ResourceType
[
form
.
cleaned_data
[
'type'
]]
# e.g: here it converts to "pubmed" idk why
resourcetype
=
cache
.
ResourceType
[
form
.
cleaned_data
[
'type'
]]
# which default language shall be used?
# which default language shall be used?
if
resourcetype
.
name
==
"europress_french"
:
if
resourcetype
.
name
==
"europress_french"
:
language_id
=
cache
.
Language
[
'fr'
]
.
id
language_id
=
cache
.
Language
[
'fr'
]
.
id
...
@@ -98,6 +100,7 @@ def project(request, project_id):
...
@@ -98,6 +100,7 @@ def project(request, project_id):
language_id
=
cache
.
Language
[
'en'
]
.
id
language_id
=
cache
.
Language
[
'en'
]
.
id
else
:
else
:
language_id
=
None
language_id
=
None
# corpus node instanciation as a Django model
# corpus node instanciation as a Django model
corpus
=
Node
(
corpus
=
Node
(
name
=
name
,
name
=
name
,
...
...
node/models.py
View file @
305f6466
...
@@ -16,6 +16,7 @@ import datetime
...
@@ -16,6 +16,7 @@ import datetime
from
multiprocessing
import
Process
from
multiprocessing
import
Process
from
math
import
log
from
math
import
log
import
collections
from
collections
import
defaultdict
from
collections
import
defaultdict
import
hashlib
import
hashlib
...
@@ -125,7 +126,7 @@ class Node(CTENode):
...
@@ -125,7 +126,7 @@ class Node(CTENode):
language
=
models
.
ForeignKey
(
Language
,
blank
=
True
,
null
=
True
,
on_delete
=
models
.
SET_NULL
)
language
=
models
.
ForeignKey
(
Language
,
blank
=
True
,
null
=
True
,
on_delete
=
models
.
SET_NULL
)
date
=
models
.
DateField
(
default
=
timezone
.
now
,
blank
=
True
)
date
=
models
.
DateField
(
default
=
timezone
.
now
,
blank
=
True
)
metadata
=
jsonfield
.
JSONField
(
blank
=
True
)
metadata
=
jsonfield
.
JSONField
(
)
#blank=True, load_kwargs={'object_pairs_hook': collections.OrderedDict}
)
ngrams
=
models
.
ManyToManyField
(
through
=
'Node_Ngram'
,
to
=
'Ngram'
)
ngrams
=
models
.
ManyToManyField
(
through
=
'Node_Ngram'
,
to
=
'Ngram'
)
...
...
test_db.py
View file @
305f6466
...
@@ -24,7 +24,7 @@ session.commit()
...
@@ -24,7 +24,7 @@ session.commit()
add_resource
(
corpus
,
add_resource
(
corpus
,
# file = './data_samples/pubmed_result.xml',
# file = './data_samples/pubmed_result.xml',
file
=
'
.
/data_samples/pubmed_2013-04-01_HoneyBeesBeeBees.xml'
,
file
=
'
/srv/gargantext_lib
/data_samples/pubmed_2013-04-01_HoneyBeesBeeBees.xml'
,
type_id
=
cache
.
ResourceType
[
'pubmed'
]
.
id
,
type_id
=
cache
.
ResourceType
[
'pubmed'
]
.
id
,
)
)
parse_resources
(
corpus
)
parse_resources
(
corpus
)
...
...
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