Make mineral admin fully editable with organized fieldsets
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Removed readonly on image_urls so URLs can be changed in admin. Added list_editable for day_of_year and color_hex for quick edits. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,25 @@ from .models import Mineral
|
|||||||
|
|
||||||
@admin.register(Mineral)
|
@admin.register(Mineral)
|
||||||
class MineralAdmin(admin.ModelAdmin):
|
class MineralAdmin(admin.ModelAdmin):
|
||||||
list_display = ('name', 'formula', 'day_of_year', 'color_hex')
|
list_display = ('name', 'formula', 'day_of_year', 'color_hex', 'category')
|
||||||
list_filter = ('category', 'crystal_system')
|
list_filter = ('category', 'crystal_system')
|
||||||
search_fields = ('name', 'formula')
|
search_fields = ('name', 'formula')
|
||||||
readonly_fields = ('image_urls',)
|
list_editable = ('day_of_year', 'color_hex')
|
||||||
|
fieldsets = (
|
||||||
|
(None, {
|
||||||
|
'fields': ('name', 'formula', 'day_of_year'),
|
||||||
|
}),
|
||||||
|
('Appearance', {
|
||||||
|
'fields': ('color_hex', 'color_description', 'image_urls'),
|
||||||
|
}),
|
||||||
|
('Properties', {
|
||||||
|
'fields': ('category', 'crystal_system', 'mohs_hardness',
|
||||||
|
'luster', 'streak', 'specific_gravity'),
|
||||||
|
}),
|
||||||
|
('Text', {
|
||||||
|
'fields': ('description', 'history'),
|
||||||
|
}),
|
||||||
|
('Links', {
|
||||||
|
'fields': ('wikipedia_url',),
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user