gmba_django/app/admin.py
2021-10-30 09:53:49 +05:30

107 lines
2.9 KiB
Python

from django.contrib import admin
from .models import *
class PersonAdmin(admin.ModelAdmin):
search_fields = ['title', 'first_name', 'last_name', 'organisation', 'position', 'country', 'contact_email']
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']
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']
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']
# Register your models here.
admin.site.register(Person, PersonAdmin)
admin.site.register(Resource, ResourceAdmin)
admin.site.register(Range, RangeAdmin)
admin.site.register(Method)
admin.site.register(Scale)
admin.site.register(Taxon)
admin.site.register(Field, FieldAdmin)
# 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)
admin.site.register(TrendsQuantity, TrendsQuantityAdmin)
admin.site.register(Repository, RepositoryAdmin)
admin.site.register(GMBA_function, GMBAFunctionAdmin)
admin.site.register(Organization, OrganizationAdmin)
admin.site.register(RangeOnlineInfo, RangeOnlineInfoAdmin)