#23499 closed Bug (fixed)
Error in built-in template tag "now" documentation
Reported by: | Joseph W. Dougherty | Owned by: | Joseph W. Dougherty |
---|---|---|---|
Component: | Documentation | Version: | 1.7 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
The [documentation for the built-in now
template tag](https://docs.djangoproject.com/en/dev/ref/templates/builtins/) says the following:
Note that you can backslash-escape a format string if you want to use the “raw” value. In this example, “f” is backslash-escaped, because otherwise “f” is a format string that displays the time. The “o” doesn’t need to be escaped, because it’s not a format character:
It is the {% now "jS o\f F" %}
Emphasis mine. This is incorrect. Per the [date
tag documentation](https://docs.djangoproject.com/en/dev/ref/templates/builtins/#std:templatefilter-date), the "o" is a format character. I have verified that "o" does require a backslash when using now
template tag in testing.
Change History (9)
comment:1 by , 10 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 10 years ago
Triage Stage: | Unreviewed → Accepted |
---|---|
Type: | Uncategorized → Bug |
comment:3 by , 10 years ago
Has patch: | set |
---|
Fix is available in the ticket_23499
branch of my repo on github: https://github.com/JDougherty/django/tree/ticket_23499
However, I feel that since there are now two backslash-escaped characters in the example, the description is a bit wordy.
I can either leave as is, attempt to rephrase, or try to come up with a different example where only one backslash would be required.
Should I hold off on the pull request? Please advise, thanks!
comment:4 by , 10 years ago
Personally i don't think the modified version is too wordy so you can go ahead and create the pull request.
comment:5 by , 10 years ago
Pull request created:
https://github.com/django/django/pull/3228
Thank you for the help, bmispelon.
comment:6 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Hi,
You're absolutely correct. It seems this was overlooked when the
o
format was added in a6b6c6e17129379fa1f9ffce1ed7eaaa5d6f1127.Thanks.