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
0081057e
Commit
0081057e
authored
Apr 20, 2016
by
delanoe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] Donut bug fixed.
parent
6c2db350
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
projects.py
gargantext/views/pages/projects.py
+6
-5
No files found.
gargantext/views/pages/projects.py
View file @
0081057e
...
@@ -61,13 +61,13 @@ from django.utils.translation import ugettext_lazy
...
@@ -61,13 +61,13 @@ from django.utils.translation import ugettext_lazy
class
NewCorpusForm
(
forms
.
Form
):
class
NewCorpusForm
(
forms
.
Form
):
type
=
forms
.
ChoiceField
(
type
=
forms
.
ChoiceField
(
choices
=
enumerate
(
resource_type
[
'name'
]
for
resource_type
in
RESOURCETYPES
),
choices
=
enumerate
(
resource_type
[
'name'
]
for
resource_type
in
RESOURCETYPES
),
widget
=
forms
.
Select
(
attrs
=
{
'onchange'
:
'CustomForSelect( $("option:selected", this).text() );'
})
widget
=
forms
.
Select
(
attrs
=
{
'onchange'
:
'CustomForSelect( $("option:selected", this).text() );'
})
)
)
name
=
forms
.
CharField
(
label
=
'Name'
,
max_length
=
199
,
widget
=
forms
.
TextInput
(
attrs
=
{
'required'
:
'true'
}))
name
=
forms
.
CharField
(
label
=
'Name'
,
max_length
=
199
,
widget
=
forms
.
TextInput
(
attrs
=
{
'required'
:
'true'
}))
file
=
forms
.
FileField
()
file
=
forms
.
FileField
()
def
clean_file
(
self
):
def
clean_file
(
self
):
file_
=
self
.
cleaned_data
.
get
(
'file'
)
file_
=
self
.
cleaned_data
.
get
(
'file'
)
if
len
(
file_
)
>
1024
**
3
:
# we don't accept more than 1GB
if
len
(
file_
)
>
1024
**
3
:
# we don't accept more than 1GB
raise
forms
.
ValidationError
(
ugettext_lazy
(
'File too heavy! (>1GB).'
))
raise
forms
.
ValidationError
(
ugettext_lazy
(
'File too heavy! (>1GB).'
))
return
file_
return
file_
...
@@ -132,9 +132,10 @@ def project(request, project_id):
...
@@ -132,9 +132,10 @@ def project(request, project_id):
sourcename2documentscount
=
defaultdict
(
int
)
sourcename2documentscount
=
defaultdict
(
int
)
for
sourcename
,
corpora
in
sourcename2corpora
.
items
():
for
sourcename
,
corpora
in
sourcename2corpora
.
items
():
sourcename
=
re
.
sub
(
'
\
(.*$'
,
''
,
sourcename
)
sourcename
=
re
.
sub
(
'
\
(.*$'
,
''
,
sourcename
)
count
=
corpus
.
children
(
'DOCUMENT'
)
.
count
()
for
corpus
in
corpora
:
sourcename2documentscount
[
sourcename
]
+=
count
count
=
corpus
.
children
(
'DOCUMENT'
)
.
count
()
total_documentscount
+=
count
sourcename2documentscount
[
sourcename
]
+=
count
total_documentscount
+=
count
donut
=
[
donut
=
[
{
'source'
:
sourcename
,
{
'source'
:
sourcename
,
'count'
:
count
,
'count'
:
count
,
...
...
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