moshthepitt / django-pagination

Automatically exported from code.google.com/p/django-pagination
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

"Caught an exception while rendering: request" when using pagination tag in a inclusion_tag #66

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
From Pinax 0.7.1 I am trying to use pagination from a customtag:

1) templatetags.squadratags.py :

def gare_list(gare, limit=1000):
    gare =
Gara.objects.filter(data__lte=datetime.now()).order_by('-data')[:limit]
    return {'gare': gare}
register.inclusion_tag('squadra/gare.html')(gare_list)

2) squadra/gare.html :

{% load pagination_tags %}
{% if gare %}  
    {% autopaginate gare 10 %}
    <table class="bookmarks">
        <tr>
            <th>Gara</th>
            <th>Luogo</th>
            <th>Data</th>
        </tr>
        {% for gara in gare %}
        <tr class="{% cycle odd,even %}">
            <td><a href="{% url dettaglio_gara gara.id %}">{{ gara.nome
}}</a></td>
            <td>{{gara.luogo }}</td>
            <td>{{ gara.data|date:"d-M-Y" }}</td>
        </tr>
        {% endfor %}
    </table>
    {% paginate %}    
{% else %}
    <p>Non ci sono gare effettuate nel database.</p>
{% endif %}

3) gara_archive.html :

{% extends "squadra/base.html" %}
{% load i18n %}
{% load squadra_tags %}
{% load pagination_tags %}
{% block head_title %}Le Gare{% endblock %}
{% block body %}
<!-- Gare Effettuate -->
<p>
{% for date in date_list %}  
    | <a href="archivio/{{ date|date:"Y"|lower }}/">{{ date|date:"Y" }}</a>
{% endfor %}
</p>
<h2>Tutte le gare effettuate</h2>
{% gare_list latest %}
{% endblock %}

I get this error:

TemplateSyntaxError at /squadra/archivio
Caught an exception while rendering: request

this line "{% autopaginate gare 10 %}" is hightlighed in the browser

thanks!

Original issue reported on code.google.com by pco...@gmail.com on 16 Mar 2010 at 11:20