2021-07-27 04:00:24 +00:00
|
|
|
from django.contrib import admin
|
2021-07-28 04:20:54 +00:00
|
|
|
from .models import *
|
2021-07-27 04:00:24 +00:00
|
|
|
|
2021-09-23 13:43:35 +00:00
|
|
|
|
|
|
|
class PersonAdmin(admin.ModelAdmin):
|
|
|
|
search_fields = ['title', 'first_name', 'last_name', 'organisation', 'position', 'country', 'contact_email']
|
|
|
|
|
|
|
|
|
2021-10-11 02:53:22 +00:00
|
|
|
class ResourceAdmin(admin.ModelAdmin):
|
|
|
|
search_fields = ['title', 'url', 'citation', 'abstract']
|
|
|
|
|
|
|
|
|
|
|
|
class RangeAdmin(admin.ModelAdmin):
|
|
|
|
search_fields = ['name', 'countries']
|
|
|
|
|
|
|
|
|
|
|
|
class FieldAdmin(admin.ModelAdmin):
|
|
|
|
search_fields = ['name']
|
|
|
|
|
|
|
|
|
2021-10-29 02:33:55 +00:00
|
|
|
class CountriesAdmin(admin.ModelAdmin):
|
|
|
|
search_fields = ['short_name', 'formal_name', 'membership_within_un_system', 'continent', 'eu_ms', 'eea_ms', 'iso3',
|
|
|
|
'iso2']
|
|
|
|
|
|
|
|
|
|
|
|
class GMBA_SpeciesGroupAdmin(admin.ModelAdmin):
|
|
|
|
search_fields = ['species_group']
|
|
|
|
|
|
|
|
|
|
|
|
class LanguageAdmin(admin.ModelAdmin):
|
|
|
|
search_fields = ['language']
|
|
|
|
|
|
|
|
|
|
|
|
class PeopleStatusAdmin(admin.ModelAdmin):
|
|
|
|
search_fields = ['status']
|
|
|
|
|
|
|
|
|
|
|
|
class RangeTypeAdmin(admin.ModelAdmin):
|
|
|
|
search_fields = ['range_type']
|
|
|
|
|
|
|
|
|
|
|
|
class RedListCategoryAdmin(admin.ModelAdmin):
|
|
|
|
search_fields = ['red_list_category']
|
|
|
|
|
|
|
|
|
|
|
|
class SourceAdmin(admin.ModelAdmin):
|
|
|
|
search_fields = ['source']
|
|
|
|
|
|
|
|
|
|
|
|
class TaxonStatusAdmin(admin.ModelAdmin):
|
|
|
|
search_fields = ['taxon_status']
|
|
|
|
|
|
|
|
|
|
|
|
class TaxonUnitAdmin(admin.ModelAdmin):
|
|
|
|
search_fields = ['taxon_status']
|
|
|
|
|
|
|
|
|
|
|
|
class TrendsQuantityAdmin(admin.ModelAdmin):
|
|
|
|
search_fields = ['trend']
|
|
|
|
|
|
|
|
|
|
|
|
class TrendsQualityAdmin(admin.ModelAdmin):
|
|
|
|
search_fields = ['trend']
|
|
|
|
|
|
|
|
|
2021-10-30 04:23:49 +00:00
|
|
|
class RepositoryAdmin(admin.ModelAdmin):
|
|
|
|
search_fields = ['repository_name', 'repository_url']
|
|
|
|
|
|
|
|
|
|
|
|
class GMBAFunctionAdmin(admin.ModelAdmin):
|
|
|
|
search_fields = ['gmba_function']
|
|
|
|
|
|
|
|
|
|
|
|
class OrganizationAdmin(admin.ModelAdmin):
|
|
|
|
search_fields = ['organisation_search', 'org_alpjha_search', 'organization_2', 'organization_3', 'subject']
|
|
|
|
|
|
|
|
|
|
|
|
class RangeOnlineInfoAdmin(admin.ModelAdmin):
|
|
|
|
search_fields = ['info_source']
|
|
|
|
|
|
|
|
|
2021-11-01 04:06:49 +00:00
|
|
|
class PeaksAdmin(admin.ModelAdmin):
|
|
|
|
search_fields = ['point_name', 'link']
|
|
|
|
|
|
|
|
|
|
|
|
class SearchAdmin(admin.ModelAdmin):
|
|
|
|
search_fields = ['search_string', 'search_date', 'result']
|
2021-11-11 17:45:04 +00:00
|
|
|
list_display = ['search_string', 'search_date', 'result']
|
|
|
|
|
|
|
|
def search_string(self, obj):
|
|
|
|
return str(obj.search_string) if obj else '--'
|
|
|
|
|
|
|
|
def search_date(self, obj):
|
|
|
|
return str(obj.search_date) if obj else '--'
|
|
|
|
|
|
|
|
def result(self, obj):
|
|
|
|
return str(obj.result) if obj else '--'
|
2021-11-01 04:06:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
class SpeciesAdmin(admin.ModelAdmin):
|
|
|
|
search_fields = ['scientific_name', 'class_', 'english_name', 'url']
|
|
|
|
|
|
|
|
|
|
|
|
class TaxonRangeAdmin(admin.ModelAdmin):
|
|
|
|
search_fields = ['subrange_or_region', 'distribution', 'source', 'remarks']
|
|
|
|
|
|
|
|
|
|
|
|
class RangeNameTranslationAdmin(admin.ModelAdmin):
|
2021-11-11 17:29:02 +00:00
|
|
|
model = RangeNameTranslation
|
|
|
|
search_fields = ['range__range_name', 'language__language']
|
|
|
|
list_display = ['range_name', 'language_translation']
|
|
|
|
|
|
|
|
def range_name(self, obj):
|
|
|
|
return str(obj.range.range_name)
|
|
|
|
|
|
|
|
def country_name(self, obj):
|
|
|
|
return str(obj.language.language) if obj.language else 'None'
|
2021-11-01 04:06:49 +00:00
|
|
|
|
|
|
|
|
2021-11-10 18:52:29 +00:00
|
|
|
class PeopleRangeAdmin(admin.ModelAdmin):
|
|
|
|
model = Range
|
|
|
|
list_display = ['person', 'range_name', ]
|
|
|
|
|
|
|
|
def range_name(self, obj):
|
|
|
|
return str(obj.range.name)
|
|
|
|
|
|
|
|
|
|
|
|
class RangeCountryAdmin(admin.ModelAdmin):
|
|
|
|
model = RangeCountry
|
|
|
|
search_fields = ['range__range_name', 'country__short_name']
|
|
|
|
list_display = ['range_name', 'country_name']
|
|
|
|
|
|
|
|
def range_name(self, obj):
|
|
|
|
return str(obj.range.range_name)
|
|
|
|
|
|
|
|
def country_name(self, obj):
|
|
|
|
return str(obj.country.short_name) if obj.country else 'None'
|
|
|
|
|
2021-11-01 04:06:49 +00:00
|
|
|
|
2021-07-27 04:00:24 +00:00
|
|
|
# Register your models here.
|
2021-09-23 13:43:35 +00:00
|
|
|
admin.site.register(Person, PersonAdmin)
|
2021-10-11 02:53:22 +00:00
|
|
|
admin.site.register(Resource, ResourceAdmin)
|
|
|
|
admin.site.register(Range, RangeAdmin)
|
2021-07-28 04:20:54 +00:00
|
|
|
admin.site.register(Method)
|
|
|
|
admin.site.register(Scale)
|
|
|
|
admin.site.register(Taxon)
|
2021-10-11 02:53:22 +00:00
|
|
|
admin.site.register(Field, FieldAdmin)
|
2021-10-29 02:33:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
# LU models
|
|
|
|
admin.site.register(Country, CountriesAdmin)
|
|
|
|
admin.site.register(GMBA_SpeciesGroup, GMBA_SpeciesGroupAdmin)
|
|
|
|
admin.site.register(Language, LanguageAdmin)
|
|
|
|
admin.site.register(PeopleStatus, PeopleStatusAdmin)
|
|
|
|
admin.site.register(RangeType, RangeTypeAdmin)
|
|
|
|
admin.site.register(RedListCategory, RedListCategoryAdmin)
|
|
|
|
admin.site.register(Source, SourceAdmin)
|
|
|
|
admin.site.register(TaxonStatus, TaxonStatusAdmin)
|
|
|
|
admin.site.register(TaxonUnit, TaxonUnitAdmin)
|
|
|
|
admin.site.register(TrendsQuality, TrendsQualityAdmin)
|
2021-10-30 04:23:49 +00:00
|
|
|
admin.site.register(TrendsQuantity, TrendsQuantityAdmin)
|
2021-11-01 04:06:49 +00:00
|
|
|
|
|
|
|
# Others
|
2021-10-30 04:23:49 +00:00
|
|
|
admin.site.register(Repository, RepositoryAdmin)
|
|
|
|
admin.site.register(GMBA_function, GMBAFunctionAdmin)
|
|
|
|
admin.site.register(Organization, OrganizationAdmin)
|
|
|
|
admin.site.register(RangeOnlineInfo, RangeOnlineInfoAdmin)
|
2021-11-01 04:06:49 +00:00
|
|
|
|
|
|
|
admin.site.register(RangeNameTranslation, RangeNameTranslationAdmin)
|
|
|
|
admin.site.register(AddElevation)
|
|
|
|
admin.site.register(GMBA_V2_Centroid)
|
|
|
|
admin.site.register(ImportGeom210915)
|
|
|
|
admin.site.register(Peak, PeaksAdmin)
|
|
|
|
admin.site.register(Search, SearchAdmin)
|
|
|
|
admin.site.register(TaxaPeople)
|
2021-11-10 18:52:29 +00:00
|
|
|
# admin.site.register(RangesPeople)
|
|
|
|
# admin.site.register(ResourcesPeople)
|
2021-11-01 04:06:49 +00:00
|
|
|
admin.site.register(ScalesPeople)
|
|
|
|
admin.site.register(Species, SpeciesAdmin)
|
|
|
|
admin.site.register(PeopleFunction)
|
|
|
|
admin.site.register(SpeciesRange)
|
2021-11-10 18:52:29 +00:00
|
|
|
admin.site.register(RangesPeople, PeopleRangeAdmin)
|
2021-11-01 04:06:49 +00:00
|
|
|
admin.site.register(TaxonRange, TaxonRangeAdmin)
|
|
|
|
admin.site.register(PeopleResource)
|
2021-11-10 18:52:29 +00:00
|
|
|
admin.site.register(RangeCountry, RangeCountryAdmin)
|