Fix admin search fields

This commit is contained in:
Matthew Ryan Dillon 2016-01-29 10:34:23 -07:00
parent fd3ce87251
commit 53f28be5ec
3 changed files with 10 additions and 9 deletions

View file

@ -15,7 +15,7 @@ class RegionAdmin(admin.ModelAdmin):
class SiteAdmin(admin.ModelAdmin):
list_display = ('name', 'code', 'region', 'description', 'sort_order')
list_display_links = ('name',)
search_fields = ('name', 'code', 'region', 'description')
search_fields = ('name', 'code', 'region__name', 'description')
list_per_page = 25
fields = ('name', 'code', 'region', 'description', 'sort_order')
@ -24,7 +24,7 @@ class MunicipalLocationAdmin(admin.ModelAdmin):
list_display = ('name', 'code', 'site', 'municipal_location_type',
'description', 'sort_order')
list_display_links = ('name',)
search_fields = ('name', 'code', 'site', 'municipal_location_type',
search_fields = ('name', 'code', 'site__name', 'municipal_location_type',
'description')
list_per_page = 25
fields = ('name', 'code', 'site', 'municipal_location_type',
@ -36,8 +36,8 @@ class StudyLocationAdmin(admin.ModelAdmin):
'treatment_type', 'municipal_location', 'collecting_location',
'description', 'sort_order')
list_display_links = ('name',)
search_fields = ('name', 'code', 'site', 'study_location_type',
'treatment_type', 'municipal_location', 'collecting_location',
search_fields = ('name', 'code', 'site__name', 'study_location_type',
'treatment_type', 'municipal_location__name', 'collecting_location',
'description')
list_per_page = 25
fields = ('name', 'code', 'site', 'study_location_type',

View file

@ -15,7 +15,8 @@ class MeasurementTypeAdmin(admin.ModelAdmin):
list_display = ('name', 'code', 'measurement_type_class', 'description',
'default_measurement_unit', 'sort_order')
list_display_links = ('name',)
search_fields = ('name', 'code', 'measurement_type_class', 'description')
search_fields = ('name', 'code', 'measurement_type_class',
'default_measurement_unit__code', 'description')
list_per_page = 25
fields = ('name', 'code', 'measurement_type_class', 'description',
'default_measurement_unit', 'sort_order')
@ -25,8 +26,8 @@ class ContainerAdmin(admin.ModelAdmin):
list_display = ('name', 'code', 'application', 'color', 'material',
'volume', 'measurement_unit', 'sort_order')
list_display_links = ('name',)
search_fields = ('name', 'code', 'application', 'color', 'material',
'volume', 'measurement_unit')
search_fields = ('name', 'code', 'application', 'color__name',
'material__name', 'volume', 'measurement_unit__name')
list_per_page = 25
fields = ('name', 'code', 'application', 'color', 'material',
'volume', 'measurement_unit', 'sort_order')

View file

@ -27,10 +27,10 @@ class GrantAdmin(admin.ModelAdmin):
class GrantReportAdmin(admin.ModelAdmin):
list_display = ('title', 'report_type', 'description', 'due_date',
list_display = ('grant', 'title', 'report_type', 'description', 'due_date',
'submitted_date', 'attachment', 'sort_order')
list_display_links = ('title',)
search_fields = ('title', 'report_type', 'description', 'due_date',
search_fields = ('grant__title', 'title', 'report_type', 'description', 'due_date',
'submitted_date', 'attachment')
list_per_page = 25
fields = ('title', 'report_type', 'description', 'due_date',