Issue #76 resolved

product-model-refactor; IndexError in base_category.html

Anonymous created an issue

If you create a product, but do not add an image. The 'standard' templates used by Satchmo will give you an IndexError.

Adding an image to a product under this branch is not required. Should Satchmo instead default to a default image/text?

The error occurs in satchmo/tempates/base_category.html. Lines 26 & 36 contain this in the image tag source:

'''{{media_url}}{{ item.main_image.get_picture_url|thumbnail:"width=85" }}'''

Basically, having no image causes the IndexError when the item.main_image is accessed.

Reported by markph

Comments (1)

  1. Anonymous

    This is caused by having a missing entry in the database for the "default" product image (IE: a placeholder "Image not found" image). This should be fixed by doing a "python manage.py syncdb". I've also just added r449 which fails more gracefully when this happens.

  2. Log in to comment