On Fri, 2006-03-03 at 03:33 +0000, oggie rob wrote: > > Err.. I suck. This should be {% for data in allyears.items %}. :-( > > Yep, that may work, but leaves the ordering up to the "items" method, > which isn't going to be ideal.
Good point. > In the case that you use a dict, you > should probably also use dictsort to make sure you get what you expect: > {% for data in allyears.items|dictsort:"0" %} > I think will work. Hmm. That looks like an unintended consequence when using dictsort, though. You are not passing it a list of dictionaries: it just also happens to work with a list of lists. Still, it works and it does solve the quite legitimate problem you point out with just using dictionary.items. > However in general, I think you should put as much logic as possible in > the views rather than the templates - which I why I suggested it was > better to use nested lists - but ultimately it depends on how easy it > is to choose between the two. Agreed (that it is often a matter of how easy it is to choose). Collating data is sometimes more easily or more efficiently done as dictionaries of lists rather than lists of lists. I'm personally not too worried about leaky abstractions here, since ordering can (not must and not always -- put down the clue bat) be viewed as pure presentation. But I can see your point, too. Malcolm --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---