class WareAdmin admin ModelAdmin search_fields name ordering -date_cre

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
class WareAdmin(admin.ModelAdmin):
search_fields = ('name',)
ordering = ('-date_created', 'name',)
list_display = (
'get_main_photo',
'name',
'date_created',
'date_updated',
'menu',
'shop',
'is_hidden',
'is_archive',
)
list_filter = (
'shop',
'menu',
'date_created',
'is_archive',
HasMainPhotoFilter
)
readonly_fields = ('date_created', 'date_updated', 'slug',)
exclude = ('popularity', )
inlines = [WarePhotoInline]
form = WareAdminForm