Add fieldsets for Resource

This commit is contained in:
PCoder 2021-11-26 17:49:49 +05:30
parent 7fd0afb8b9
commit 12112fb954
2 changed files with 22 additions and 33 deletions

View file

@ -14,17 +14,18 @@ Bugfixes:
> Elev low, Elev high, eleve range, eleve avg: does not show in access
- Resources
1. Search seems to work as it should on django admin for Resources app, so I could locate the following entry to compare 1:1 to access.
[x] 1. Search seems to work as it should on django admin for Resources app, so I could locate the following entry to compare 1:1 to access.
Relative contribution of soil, management and traits to co-variations of multiple ecosystem properties in grasslands
https://gmba-django-internal.ungleich.ch/admin/app/resource/1/change/?_changelist_filters=q%3Drelative%2Bcontribution
[x] stars needs to be dropdown choice instead of text field
in Access, the URL link is clickable, in django it isn't: in django the url is wrapped in #
in Access, Type is dropdown choice
PEGASuS Check map with author needs to be checkbox
Gloria, Gnomo, LTER, LTSER, MIREN, TEAM, Inventory needs to be checkbox
[x] in Access, the URL link is clickable, in django it isn't: in django the url is wrapped in #
[x] in Access, Type is dropdown choice
[x] PEGASuS Check map with author needs to be checkbox
[x] Gloria, Gnomo, LTER, LTSER, MIREN, TEAM, Inventory needs to be checkbox
2. Ranges should have dropdown field, screenshot attached
3. Keywords should have dropdown field, screenshot attached
4. People should have Person/Role subcategory and dropdowns, screenshot attached
[x] 5. Fix the order of fields
## 1.1 (2021-11-26)

View file

@ -47,34 +47,22 @@ class PersonAdmin(admin.ModelAdmin):
class ResourceAdmin(admin.ModelAdmin):
search_fields = ['title', 'url', 'citation', 'abstract']
readonly_fields = ['resource_url']
# search_fields = ['organisation_search', 'org_alpha_search', 'organisation_2', 'organisation_3', 'subject']
# list_display = ['organisation_english', 'country', 'city']
# fieldsets = (
# (None, {
# 'fields': (
# ('org_num1', 'acronym', 'category', 'subject'),
# 'organisation_english',
# ('organisation_2', 'organisation_3'),
# 'organisation_original',
# )
# }),
# ('Address', {
# 'classes': ('collapse',),
# 'fields': (
# ('street', 'postcode', 'city'),
# ('po_box', 'country', 'lat_long'),
# )
# }),
# ('Other details', {
# 'classes': ('collapse',),
# 'fields': (('tel', 'email'),
# 'url',
# 'org_url',
# 'tags',
# ),
# })
# )
readonly_fields = ['resource_url', 'id']
list_display = ['title', 'country', 'city']
fieldsets = (
(None, {
'fields': (
('id', 'stars'),
'title',
'citation',
('type',),
('url', 'resource_url'),
('lat', 'lon'),
'doi',
'wiki_data_id',
)
})
)
def resource_url(self, instance):
return format_html('<a href="{0}" target="_blank">{1}</a>',