Ticket #13452: regroup-choices-2.diff
File regroup-choices-2.diff, 1.3 KB (added by , 15 years ago) |
---|
-
docs/ref/models/instances.txt
515 515 More details on named URL patterns are in the :ref:`URL dispatch documentation 516 516 <topics-http-urls>`. 517 517 518 .. _extra-instance-methods: 519 518 520 Extra instance methods 519 521 ====================== 520 522 -
docs/ref/templates/builtins.txt
825 825 826 826 {% regroup people|dictsort:"gender" by gender as gender_list %} 827 827 828 Note that *methods* are also valid arguments to the regroup tag. For 829 example, if the "gender" field on the model in this example is a CHOICES 830 field rather than a foreign key, ``{{ gender.grouper }}`` will naturally 831 have a :ref:`get_FOO_display() <extra-instance-methods>` method 832 available as an attribute, so you can group on the display string 833 rather than the CHOICES key:: 834 835 {% regroup people by get_gender_display as gender_list %} 836 837 ``{{ gender.grouper }}`` will now display the value fields from the 838 CHOICES set rather than the keys. 839 828 840 .. templatetag:: spaceless 829 841 830 842 spaceless