1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

[1.7.x] Fixed display of lists after website redesign

Thanks Brian Jacobel for the report. refs django/djangoproject.com#197

Backport of c7786550c4 from master
This commit is contained in:
Markus Holtermann
2014-12-17 14:01:19 +01:00
committed by Tim Graham
parent ebfb1dab26
commit a38951948a
4 changed files with 38 additions and 23 deletions

View File

@@ -821,13 +821,18 @@ This complex tag is best illustrated by way of an example: say that "places" is
...and you'd like to display a hierarchical list that is ordered by country, like this:
* India
* Mumbai: 19,000,000
* Calcutta: 15,000,000
* Mumbai: 19,000,000
* Calcutta: 15,000,000
* USA
* New York: 20,000,000
* Chicago: 7,000,000
* New York: 20,000,000
* Chicago: 7,000,000
* Japan
* Tokyo: 33,000,000
* Tokyo: 33,000,000
You can use the ``{% regroup %}`` tag to group the list of cities by country.
@@ -881,15 +886,24 @@ With this input for ``cities``, the example ``{% regroup %}`` template code
above would result in the following output:
* India
* Mumbai: 19,000,000
* Mumbai: 19,000,000
* USA
* New York: 20,000,000
* New York: 20,000,000
* India
* Calcutta: 15,000,000
* Calcutta: 15,000,000
* USA
* Chicago: 7,000,000
* Chicago: 7,000,000
* Japan
* Tokyo: 33,000,000
* Tokyo: 33,000,000
The easiest solution to this gotcha is to make sure in your view code that the
data is ordered according to how you want to display it.