Merge pull request #195 from bornhack/feature/improve_shop_product_admin

Woops, available_in can be null
This commit is contained in:
Stephan Telling 2018-01-07 17:16:49 +01:00 committed by GitHub
commit 914c4e456e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -35,11 +35,15 @@ class ProductCategoryAdmin(admin.ModelAdmin):
def available_from(product):
return product.available_in.lower.strftime("%c")
if product.available_in:
return product.available_in.lower.strftime("%c")
return "None"
available_from.short_description = 'Available from'
def available_to(product):
return product.available_in.upper.strftime("%c")
if product.available_in:
return product.available_in.upper.strftime("%c")
return "None"
available_to.short_description = 'Available to'