On 12/4/06 4:34 PM, Ross Burton wrote:
> In my view, I'm grouping the data on the priority:
> 
> {% regroup feature.task_set.all|dictsortreversed:"priority" by priority
> as grouped %}
> {% for group in grouped %}
>   <h2>{{ group.grouper }}</h2>
> 
> However, when I do this, group.grouper expands to "0" or "2", not "Low"
> or High".  How can I get the display name for this field?

Try::

{% regroup feature.task_set.all|dictsortreversed:"priority" by 
get_priority_display as grouped %}

That is, the "by" argument to {% regroup %} doesn't just have to be a field 
name; it can be anything that a variable could resolve.

Jacob

--~--~---------~--~----~------------~-------~--~----~
 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to