Changes between Version 4 and Version 5 of CookBookTemplateTagRegroup
- Timestamp:
- Mar 3, 2006, 1:29:03 AM (19 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
CookBookTemplateTagRegroup
v4 v5 2 2 django version : 0.91 3 3 4 If you need to group a list of objects by a choice like fied '''choices = CATEGORY_CHOICES''',4 If you need to group a list of objects by a choice (eg, field has '''choices = CATEGORY_CHOICES'''), 5 5 here is the trick. 6 6 7 A Model. 7 '''The Model:''' 8 8 {{{ 9 9 #!python … … 25 25 }}} 26 26 27 The Regroup tag in action, the thing is that you don't want to display the category28 number bit its corresponding name. (e.g not '1' but 'Entrées').27 And here is the {{{regroup}}} tag in action. The thing is that you don't want to display the category 28 number, but its corresponding name. (e.g not '1' but 'Entrées'). 29 29 30 Temmplate 30 '''The Template:''' 31 31 {{{ 32 32 #!python