Hello, On nearly every page of the website I'm creating, I have a list of recent articles in the sidebar that works as a complete archive. You can sort them by newest/oldest, and page through the entire archive. The template code for the pagination looks like this
{% for page_number in page_list %} {% ifnotequal page_number current_page %} <a class="deselected" href="?p={{ page_number }}&sort={{sort_order}}">{{page_number}}</a> {% else %} {{ page_number }} {% endifnotequal %} {% endfor %} As a result, as soon as you sort, or page through, the url gets a querystring appended to it. I'd like to keep them as clean as possible, so I was thinking of only adding the sort_order to the pagination hrefs if it's not the default. Something like: {% for page_number in page_list %} {% ifnotequal page_number current_page %} <a class="deselected" href="?p={{ page_number }} {% ifnotequal sort_order default_sort }} &sort={{sort_order}} {% endifnotequal %} ">{{page_number}}</a> {% else %} {{ page_number }} {% endifnotequal %} {% endfor %} But I'm unhappy that there's so much logic in the template, and it's getting hard to read. I understand that maybe every page shouldn't have this list with ordering and pagination, but it's something I'm experimenting with, and I'd like to get it working in the best order I can. I thought about doing most of the processing in the view and outputting the pagination as a single string, but then I've moved at least a small bit of HTML into my view. I feel like there should be a cleaner way. Am I doing something wrong, or is this an acceptable level of logic in the template? I hope that's clear. Thanks --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---