Reputation: 186
I have context information sent to this part of the view. Have a paginator and works well for pages 1-3. But going to page four it has this error.
Exception Type: ValueError
Exception Value: The 'image' attribute has no file associated with it.
The error in the template is highlighted by django debug as
Error during template rendering
In template /templates/marketplace/entry_list.html
, error at line 91:
The 'image' attribute has no file associated with it.
<a href="{{ e.get_absolute_url }}" title="{{ e.title }}">
{% if e.picture.url %}
{% thumbnail e.picture "300x600" as thumb %}
<img src="{{ thumb.url }}" alt="{{ e.title }}" />
{% endthumbnail %}
{% endif %}
</a>
The part of the view sending context info is as below
get_context_data(self, **kwargs):
if self.request.mobile:
self.template_name = 'mobile/buy_n_sell.html'
today = datetime.date.today()
context = super(EntryList, self).get_context_data(**kwargs)
context['category'] = self.category
try:
children = self.category.get_child_categories()
except:
children = None
context['child_category'] = children
context['area'] = self.area
return context
Upvotes: 0
Views: 2878
Reputation: 144
use this code. maybe it will work fine for you..
<a href="{{ e.get_absolute_url }}" title="{{ e.title }}">
{% if e.picture.url %}
{% thumbnail e.picture "300x600" as thumb %}
<img src="{{ e.thumb.url }}" alt="{{ e.title }}" />
{% endthumbnail %}
{% endif %}
Upvotes: 1