Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Arkindex
Backend
Commits
2dcb4c7d
Commit
2dcb4c7d
authored
2 years ago
by
Erwan Rouchet
Committed by
Bastien Abadie
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix EntityType creation and deletion in the Django admin
parent
454da644
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1941
Fix EntityType creation and deletion in the Django admin
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
arkindex/documents/admin.py
+12
-2
12 additions, 2 deletions
arkindex/documents/admin.py
with
12 additions
and
2 deletions
arkindex/documents/admin.py
+
12
−
2
View file @
2dcb4c7d
...
...
@@ -157,9 +157,19 @@ class EntityRoleAdmin(admin.ModelAdmin):
class
EntityTypeAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'
id
'
,
'
name
'
,
'
color
'
)
list_display
=
(
'
id
'
,
'
corpus
'
,
'
name
'
,
'
color
'
)
list_filter
=
(
'
corpus
'
,
)
readonly_fields
=
(
'
id
'
,
'
corpus
'
,
)
def
get_readonly_fields
(
self
,
request
,
obj
=
None
):
# Make the corpus field read-only only for existing entity types.
# Otherwise, new EntityTypes would be created with corpus=None
if
obj
:
return
(
'
id
'
,
'
corpus
'
)
return
(
'
id
'
,
)
def
has_delete_permission
(
self
,
request
,
obj
=
None
):
# Require everyone to use the frontend or DestroyEntityType
return
False
admin
.
site
.
register
(
Corpus
,
CorpusAdmin
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment