Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#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 Joseph W. Dougherty, 10 years ago

Owner: changed from nobody to Joseph W. Dougherty
Status: newassigned

comment:2 by Baptiste Mispelon, 10 years ago

Triage Stage: UnreviewedAccepted
Type: UncategorizedBug

Hi,

You're absolutely correct. It seems this was overlooked when the o format was added in a6b6c6e17129379fa1f9ffce1ed7eaaa5d6f1127.

Thanks.

comment:3 by Joseph W. Dougherty, 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 Baptiste Mispelon, 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 Joseph W. Dougherty, 10 years ago

Pull request created:
https://github.com/django/django/pull/3228

Thank you for the help, bmispelon.

comment:6 by Baptiste Mispelon <bmispelon@…>, 10 years ago

Resolution: fixed
Status: assignedclosed

In ab8248361e0a7b4fc7684eaaa5891e16b8562683:

Fixed #23499 -- Error in built-in template tag "now" documentation

comment:7 by Baptiste Mispelon <bmispelon@…>, 10 years ago

In 722516536e0dd99690ab6df4c27bbceb29df4d5b:

[1.7.x] Fixed #23499 -- Error in built-in template tag "now" documentation

Backport of ab8248361e0a7b4fc7684eaaa5891e16b8562683 from master.

comment:8 by Baptiste Mispelon <bmispelon@…>, 10 years ago

In 3132edae41dbb13b924e98e8f0254e847155a050:

[1.4.x] Fixed #23499 -- Error in built-in template tag "now" documentation

Backport of ab8248361e0a7b4fc7684eaaa5891e16b8562683 from master.

comment:9 by Baptiste Mispelon <bmispelon@…>, 10 years ago

In 9a66244bd8c8b7202ff51f4aa6069f716ab64317:

[1.6.x] Fixed #23499 -- Error in built-in template tag "now" documentation

Backport of ab8248361e0a7b4fc7684eaaa5891e16b8562683 from master.

Note: See TracTickets for help on using tickets.
Back to Top