Set up admin for project-level items
This commit is contained in:
parent
510568d53b
commit
db8d52ef68
3 changed files with 47 additions and 22 deletions
|
@ -1,7 +1,8 @@
|
|||
from django.contrib import admin
|
||||
|
||||
from .models import CollectionType, CollectionMethod, Flaw, ADFGPermit, \
|
||||
DatasheetAttachment, CollectionTrap
|
||||
from .models import (CollectionType, CollectionMethod, Flaw, ADFGPermit,
|
||||
DatasheetAttachment, CollectionTrap, Collection)
|
||||
from ..species.models import CollectionSpecies
|
||||
|
||||
|
||||
class CollectionTypeAdmin(admin.ModelAdmin):
|
||||
|
@ -45,11 +46,25 @@ class DatasheetAttachmentAdmin(admin.ModelAdmin):
|
|||
|
||||
class CollectionTrapAdmin(admin.ModelAdmin):
|
||||
list_display = ('collection', 'number_of_traps', 'date_opened',
|
||||
'time_opened', 'date_closed', 'time_closed')
|
||||
'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')
|
||||
'time_opened', 'date_closed', 'time_closed')
|
||||
|
||||
|
||||
class CollectionSpeciesInlineAdmin(admin.TabularInline):
|
||||
model = CollectionSpecies
|
||||
|
||||
|
||||
class CollectionAdmin(admin.ModelAdmin):
|
||||
inlines = (CollectionSpeciesInlineAdmin, )
|
||||
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)
|
||||
|
@ -58,3 +73,4 @@ 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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue