Optimize Resource detail admin page
This commit is contained in:
parent
32b7d4e395
commit
77f8d6da89
1 changed files with 13 additions and 0 deletions
13
app/admin.py
13
app/admin.py
|
@ -70,15 +70,21 @@ class PersonAdmin(admin.ModelAdmin):
|
|||
|
||||
|
||||
class ResourceKeywordInline(admin.TabularInline):
|
||||
autocomplete_fields = ['keyword']
|
||||
model = ResourceKeyword
|
||||
extra = 0
|
||||
|
||||
|
||||
class ResourceRangeInline(admin.TabularInline):
|
||||
autocomplete_fields = ['range_name']
|
||||
model = ResourceRange
|
||||
extra = 0
|
||||
|
||||
|
||||
class ResourcePeopleInline(admin.TabularInline):
|
||||
autocomplete_fields = ['person']
|
||||
model = PeopleResource
|
||||
extra = 0
|
||||
formfield_overrides = {
|
||||
models.CharField: {'widget': TextInput(attrs={'size': '20'})}
|
||||
}
|
||||
|
@ -122,6 +128,7 @@ class ResourceAdmin(admin.ModelAdmin):
|
|||
'PEGASuS_Check_map_with_author',),)
|
||||
}),
|
||||
)
|
||||
list_per_page = settings.ADMIN_LIST_PER_PAGE
|
||||
|
||||
|
||||
class RangeNameTranslationInline(admin.TabularInline):
|
||||
|
@ -366,10 +373,16 @@ class RangeCountryAdmin(admin.ModelAdmin):
|
|||
return str(obj.country.short_name) if obj.country else 'None'
|
||||
|
||||
|
||||
class KeywordAdmin(admin.ModelAdmin):
|
||||
search_fields = ['keyword']
|
||||
|
||||
|
||||
# Register your models here.
|
||||
admin.site.register(Person, PersonAdmin)
|
||||
admin.site.register(Resource, ResourceAdmin)
|
||||
admin.site.register(MountainRange, RangeAdmin)
|
||||
|
||||
admin.site.register(Keyword, KeywordAdmin)
|
||||
# admin.site.register(Method)
|
||||
# admin.site.register(Scale)
|
||||
# admin.site.register(Taxon)
|
||||
|
|
Loading…
Reference in a new issue