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
0bfa5a82
Commit
0bfa5a82
authored
4 years ago
by
Eva Bardou
Browse files
Options
Downloads
Patches
Plain Diff
Prevent element_corpus update + Disable Element creation in admin panel
parent
ccdc7abc
No related branches found
No related tags found
1 merge request
!1316
Prevent element_corpus update + Disable Element creation in admin panel
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
arkindex/documents/admin.py
+5
-1
5 additions, 1 deletion
arkindex/documents/admin.py
with
5 additions
and
1 deletion
arkindex/documents/admin.py
+
5
−
1
View file @
0bfa5a82
...
...
@@ -71,10 +71,14 @@ class ElementAdmin(admin.ModelAdmin):
list_display
=
(
'
id
'
,
'
name
'
,
'
type
'
,
'
corpus
'
,
)
list_filter
=
[
'
type__slug
'
,
'
corpus
'
]
fields
=
(
'
id
'
,
'
type
'
,
'
name
'
,
'
corpus
'
)
readonly_fields
=
(
'
id
'
,
)
readonly_fields
=
(
'
id
'
,
'
corpus
'
,
)
search_fields
=
(
'
name
'
,
)
inlines
=
(
MetaDataInline
,
ClassificationInline
)
# Disable element creation through the admin to prevent element_type conflicts
def
has_add_permission
(
self
,
request
):
return
False
def
formfield_for_foreignkey
(
self
,
db_field
,
request
,
**
kwargs
):
if
db_field
.
name
==
'
type
'
:
# Only display types available on the element's corpus
...
...
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