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
7fcf8281
Commit
7fcf8281
authored
Sep 05, 2014
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
import Europresse to database web ok
parent
755370b9
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
606 additions
and
28 deletions
+606
-28
Gargantext_web-checkpoint.ipynb
.ipynb_checkpoints/Gargantext_web-checkpoint.ipynb
+288
-0
Gargantext_web.ipynb
Gargantext_web.ipynb
+288
-0
admin.py
documents/admin.py
+29
-28
settings.py
settings.py
+1
-0
No files found.
.ipynb_checkpoints/Gargantext_web-checkpoint.ipynb
0 → 100644
View file @
7fcf8281
This diff is collapsed.
Click to expand it.
Gargantext_web.ipynb
0 → 100644
View file @
7fcf8281
This diff is collapsed.
Click to expand it.
documents/admin.py
View file @
7fcf8281
...
...
@@ -7,7 +7,7 @@ from documents.models import Database, Language, Project, Corpus, Document
class
DocumentInLine
(
NestedStackedInline
):
model
=
Document
extra
=
1
extra
=
0
class
CorpusInLine
(
NestedStackedInline
):
model
=
Corpus
...
...
@@ -41,7 +41,7 @@ class ProjectAdmin(NestedModelAdmin):
class
CorpusAdmin
(
admin
.
ModelAdmin
):
exclude
=
(
'analyst'
,)
list_display
=
(
'
title'
,
'date'
,
'analyst
'
)
list_display
=
(
'
analyst'
,
'database'
,
'date'
,
'title
'
)
inlines
=
[
DocumentInLine
,]
...
...
@@ -64,36 +64,37 @@ class CorpusAdmin(admin.ModelAdmin):
obj
.
analyst
=
request
.
user
obj
.
save
()
#
#class DocumentAdmin(admin.ModelAdmin):
# exclude = ('analyst',)
# list_display = ('date', 'source', 'title')
#
#
# def has_change_permission(self, request, obj=None):
# has_class_permission = super(DocumentAdmin, self).has_change_permission(request, obj)
# if not has_class_permission:
# return False
# if obj is not None and not request.user.is_superuser and request.user.id != obj.analyst.id:
# return False
# return True
#
# def get_queryset(self, request):
# if request.user.is_superuser:
# return Document.objects.all()
#
# return Document.objects.filter(analyst=request.user)
#
# def save_model(self, request, obj, form, change):
# if not change:
# obj.analyst = request.user
# obj.save()
#
class
DocumentAdmin
(
admin
.
ModelAdmin
):
exclude
=
(
'analyst'
,)
list_display
=
(
'date'
,
'source'
,
'title'
)
list_per_page
=
20
def
has_change_permission
(
self
,
request
,
obj
=
None
):
has_class_permission
=
super
(
DocumentAdmin
,
self
)
.
has_change_permission
(
request
,
obj
)
if
not
has_class_permission
:
return
False
if
obj
is
not
None
and
not
request
.
user
.
is_superuser
and
request
.
user
.
id
!=
obj
.
analyst
.
id
:
return
False
return
True
def
get_queryset
(
self
,
request
):
if
request
.
user
.
is_superuser
:
return
Document
.
objects
.
all
()
return
Document
.
objects
.
filter
(
analyst
=
request
.
user
)
def
save_model
(
self
,
request
,
obj
,
form
,
change
):
if
not
change
:
obj
.
analyst
=
request
.
user
obj
.
save
()
admin
.
site
.
register
(
Database
)
admin
.
site
.
register
(
Language
)
admin
.
site
.
register
(
Project
,
ProjectAdmin
)
admin
.
site
.
register
(
Corpus
,
CorpusAdmin
)
#
admin.site.register(Document, DocumentAdmin)
admin
.
site
.
register
(
Document
,
DocumentAdmin
)
settings.py
View file @
7fcf8281
...
...
@@ -37,6 +37,7 @@ INSTALLED_APPS = (
'django.contrib.sessions'
,
'django.contrib.messages'
,
'django.contrib.staticfiles'
,
'django_extensions'
,
#'south',
'documents'
,
'django_hstore'
,
...
...
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