Merge pull request #193 from bornhack/feature/improve_shop_product_admin

Adding search and improve stuff on shop product admin.
This commit is contained in:
Stephan Telling 2018-01-07 16:00:13 +01:00 committed by GitHub
commit 84f187709b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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