Opened 9 years ago
Closed 9 years ago
#26545 closed Cleanup/optimization (duplicate)
Improve documentation of numeric dictsort template filter arguments
Reported by: | Filipa Andrade | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 1.9 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
The dictsort template filter is commonly used in Django with the following syntax (from django.views.debug):
{% for k, v in settings.items|dictsort:0 %} {{ k }} = {{ v|stringformat:"r" }} {% endfor %}
In the documentation it is not clear what the 0 argument means.
Would be great to add that explanation: when using an integer value as an argument the dictionary will be sorted according to the character in the position given by the argument. Basically that 0 means that it will be sorted alphabetically as 0 is the first character of the keys string.
Change History (1)
comment:1 by , 9 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Summary: | Improve documentation of dictsort template filter arguments → Improve documentation of numeric dictsort template filter arguments |
Note:
See TracTickets
for help on using tickets.
The usage of numeric arguments is a change in the Django master branch (1.10) and documentation was added as part of #25670.