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:
commit
84f187709b
|
@ -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)
|
@admin.register(models.Product)
|
||||||
class ProductAdmin(admin.ModelAdmin):
|
class ProductAdmin(admin.ModelAdmin):
|
||||||
list_display = [
|
list_display = [
|
||||||
|
@ -41,9 +50,13 @@ class ProductAdmin(admin.ModelAdmin):
|
||||||
'category',
|
'category',
|
||||||
'ticket_type',
|
'ticket_type',
|
||||||
'price',
|
'price',
|
||||||
'available_in',
|
'description',
|
||||||
|
available_from,
|
||||||
|
available_to
|
||||||
]
|
]
|
||||||
|
|
||||||
|
search_fields = ['name']
|
||||||
|
|
||||||
|
|
||||||
class ProductInline(admin.TabularInline):
|
class ProductInline(admin.TabularInline):
|
||||||
model = models.OrderProductRelation
|
model = models.OrderProductRelation
|
||||||
|
|
Loading…
Reference in a new issue