Opened 18 years ago
Closed 18 years ago
#4793 closed (fixed)
template documentation has wrong example
| Reported by: | Owned by: | nobody | |
|---|---|---|---|
| Component: | Documentation | Version: | dev |
| Severity: | Keywords: | ||
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
following code causes "module has no stringfilter" error
from django import template @template.stringfilter def lower(value): return value.lower()
you also need to register that filter (stringfilter is not registering it). correct example would be:
from django import template @register.filter(name="endswith") @template.defaultfilters.stringfilter def endswith(value,arg): return value.endswith(arg)
Attachments (1)
Change History (4)
comment:1 by , 18 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
by , 18 years ago
| Attachment: | 4793.patch added |
|---|
comment:2 by , 18 years ago
| Has patch: | set |
|---|---|
| Triage Stage: | Accepted → Ready for checkin |
comment:3 by , 18 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Example is here: http://www.djangoproject.com/documentation/templates_python/#template-filters-which-expect-strings
The example just shows the code which needs to be added for the specific case, not a full working example of a template.
...although perhaps the "registering a filter" bit could have a heading of it's own and it could go below "template filters which expect strings" to clarify things.