Adding search and improve stuff on shop product admin.

This commit is contained in:
Víðir Valberg Guðmundsson 2018-01-07 15:56:52 +01:00
parent a0c646e1cf
commit 004be0a834

View file

@ -34,6 +34,15 @@ class ProductCategoryAdmin(admin.ModelAdmin):
]
def available_from(product):
return product.available_in.lower.strftime("%c")
available_from.short_description = 'Available from'
def available_to(product):
return product.available_in.upper.strftime("%c")
available_to.short_description = 'Available to'
@admin.register(models.Product)
class ProductAdmin(admin.ModelAdmin):
list_display = [
@ -41,9 +50,13 @@ class ProductAdmin(admin.ModelAdmin):
'category',
'ticket_type',
'price',
'available_in',
'description',
available_from,
available_to
]
search_fields = ['name']
class ProductInline(admin.TabularInline):
model = models.OrderProductRelation