Opened 17 years ago
Closed 17 years ago
#5699 closed (invalid)
Generic views' page_range values incomparable to (current) page integer
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Generic views | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Consider this typical example --
<div class="pagenav">
Page
{% for p in page_range %}
<a href="{{ url }}{{ p }}/"{% ifequal page p %} class="sel"{% endifequal %}>{{ p }}</a>
{% endfor %}
{% if next_page %}
<a href="{{ url }}{{ next_page }}/">Next</a>
{% endif %}
</div>
Ooops, doesn't work! Ifequal doesn't seem to be able to compare the current page (integer) to variables in the page_range list.
Aside, it seems type handling can be unnecessarily tedious at times, particularly when using things like Decimal.
Change History (2)
comment:1 by , 17 years ago
comment:2 by , 17 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Seems to work fine here. Using this test case and the template fragment you posted
data = { 'queryset': Session.objects.all(), 'template_name': 'foo.html', 'paginate_by': 2, } urlpatterns = patterns('', (r'^example/(?P<page>\d+)/$', object_list, data), )
with more than two items in my sessions table, I get the "page" item having the "sel" class added (and only that item).
Please reopen if you have a short, complete example that demonstrates the problem.
Let me try that again --