Kilian CAVALOTTI wrote: >Currently, I have: >{% for l in list|dictsort:"name" %} >... >{% endfor %} > >I can replace "name" by a variable, but I'd also like to replace 'reversed' by >a variable, to be able to control the sort order from the GET payload. > >Is there a way to achieve this? Or another mean to control sort fields and >order from GET for a list? > > There is a way but not in a template. This is typically done in a view by sorting the list by waht you want and passing it in a template in final order.
>In a more general way, it would be very convenient to be able to pass >parameters to templates blocks, > One of the design principles of Django templates is that such logic is moved out of them into view level. > I often use the same HTML blocks with a slight parameter changing (like class >attribute), and I currently have to duplicate these redundant blocks. > Use custom template tags. They are intended just for this sort of things. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---