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
656dc465
Commit
656dc465
authored
1 year ago
by
Valentin Rigal
Committed by
Erwan Rouchet
11 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Update admin
parent
dd784733
No related branches found
No related tags found
1 merge request
!2276
Dataset unique elements
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
arkindex/training/admin.py
+10
-2
10 additions, 2 deletions
arkindex/training/admin.py
with
10 additions
and
2 deletions
arkindex/training/admin.py
+
10
−
2
View file @
656dc465
...
...
@@ -36,13 +36,21 @@ class DatasetSetInLine(admin.StackedInline):
class
DatasetAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
"
name
"
,
"
corpus
"
,
"
state
"
)
list_display
=
(
"
name
"
,
"
corpus
"
,
"
state
"
,
"
unique_elements
"
)
list_filter
=
((
"
state
"
,
EnumFieldListFilter
),
"
corpus
"
)
search_fields
=
(
"
name
"
,
"
description
"
)
fields
=
(
"
id
"
,
"
name
"
,
"
created
"
,
"
updated
"
,
"
description
"
,
"
corpus
"
,
"
creator
"
,
"
task
"
)
fields
=
(
"
id
"
,
"
name
"
,
"
created
"
,
"
updated
"
,
"
description
"
,
"
corpus
"
,
"
creator
"
,
"
task
"
,
"
unique_elements
"
)
readonly_fields
=
(
"
id
"
,
"
created
"
,
"
updated
"
,
"
task
"
)
inlines
=
[
DatasetSetInLine
,
]
def
get_form
(
self
,
request
,
obj
=
None
,
**
kwargs
):
# Prevent editing the `unique_elements` attribute
self
.
readonly_fields
=
self
.
__class__
.
readonly_fields
if
obj
is
not
None
:
self
.
readonly_fields
+=
(
"
unique_elements
"
,)
form
=
super
().
get_form
(
request
,
obj
=
None
,
**
kwargs
)
return
form
admin
.
site
.
register
(
Model
,
ModelAdmin
)
admin
.
site
.
register
(
ModelVersion
,
ModelVersionAdmin
)
...
...
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