81 lines
2.8 KiB
Python
81 lines
2.8 KiB
Python
from django.contrib import admin
|
|
|
|
from .models import (CollectionType, CollectionMethod, Flaw, ADFGPermit,
|
|
DatasheetAttachment, CollectionTrap, Collection,
|
|
CollectionMeasurement)
|
|
from ..species.models import CollectionSpecies
|
|
|
|
|
|
class CollectionTypeAdmin(admin.ModelAdmin):
|
|
list_display = ('name', 'code', 'sort_order')
|
|
list_display_links = ('name',)
|
|
search_fields = ('name', 'code')
|
|
list_per_page = 25
|
|
fields = ('name', 'code', 'sort_order')
|
|
|
|
|
|
class CollectionMethodAdmin(admin.ModelAdmin):
|
|
list_display = ('name', 'code', 'collection_method_class', 'sort_order')
|
|
list_display_links = ('name',)
|
|
search_fields = ('name', 'code', 'collection_method_class')
|
|
list_per_page = 25
|
|
fields = ('name', 'code', 'collection_method_class', 'sort_order')
|
|
|
|
|
|
class FlawAdmin(admin.ModelAdmin):
|
|
list_display = ('name', 'description', 'sort_order')
|
|
list_display_links = ('name',)
|
|
search_fields = ('name', 'description')
|
|
list_per_page = 25
|
|
fields = ('name', 'description')
|
|
|
|
|
|
class ADFGPermitAdmin(admin.ModelAdmin):
|
|
list_display = ('name', 'sort_order')
|
|
list_display_links = ('name',)
|
|
search_fields = ('name',)
|
|
list_per_page = 25
|
|
fields = ('name', 'sort_order')
|
|
|
|
|
|
class DatasheetAttachmentAdmin(admin.ModelAdmin):
|
|
list_display = ('collection', 'datasheet')
|
|
list_display_links = ('datasheet',)
|
|
list_per_page = 25
|
|
fields = ('collection', 'datasheet')
|
|
|
|
|
|
class CollectionTrapAdmin(admin.ModelAdmin):
|
|
list_display = ('collection', 'number_of_traps', 'date_opened',
|
|
'time_opened', 'date_closed', 'time_closed')
|
|
list_display_links = ('number_of_traps',)
|
|
list_per_page = 25
|
|
fields = ('collection', 'number_of_traps', 'date_opened',
|
|
'time_opened', 'date_closed', 'time_closed')
|
|
|
|
|
|
class CollectionSpeciesInlineAdmin(admin.TabularInline):
|
|
model = CollectionSpecies
|
|
|
|
|
|
class CollectionMeasurementInlineAdmin(admin.TabularInline):
|
|
model = CollectionMeasurement
|
|
|
|
|
|
class CollectionAdmin(admin.ModelAdmin):
|
|
inlines = (CollectionSpeciesInlineAdmin, CollectionMeasurementInlineAdmin)
|
|
list_display = ('project', 'study_location', 'collection_end_date',
|
|
'collection_type', 'collection_method')
|
|
list_display_links = ('project', 'study_location', 'collection_end_date',
|
|
'collection_type', 'collection_method')
|
|
list_filter = ('project', 'study_location', 'collection_type',
|
|
'collection_method')
|
|
|
|
|
|
admin.site.register(CollectionType, CollectionTypeAdmin)
|
|
admin.site.register(CollectionMethod, CollectionMethodAdmin)
|
|
admin.site.register(Flaw, FlawAdmin)
|
|
admin.site.register(ADFGPermit, ADFGPermitAdmin)
|
|
admin.site.register(DatasheetAttachment, DatasheetAttachmentAdmin)
|
|
admin.site.register(CollectionTrap, CollectionTrapAdmin)
|
|
admin.site.register(Collection, CollectionAdmin)
|