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 > Elev low, Elev high, eleve range, eleve avg: does not show in access
- Resources - 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 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 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 [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 # [x] 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 [x] in Access, Type is dropdown choice
PEGASuS Check map with author needs to be checkbox [x] PEGASuS Check map with author needs to be checkbox
Gloria, Gnomo, LTER, LTSER, MIREN, TEAM, Inventory needs to be checkbox [x] Gloria, Gnomo, LTER, LTSER, MIREN, TEAM, Inventory needs to be checkbox
2. Ranges should have dropdown field, screenshot attached 2. Ranges should have dropdown field, screenshot attached
3. Keywords 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 4. People should have Person/Role subcategory and dropdowns, screenshot attached
[x] 5. Fix the order of fields
## 1.1 (2021-11-26) ## 1.1 (2021-11-26)

View file

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