#31006: Document how to escape a date/time format character for the |date and
|time
filters
------------------------------------------------+------------------------
Reporter: Baptiste Mispelon | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
------------------------------------------------+------------------------
The current documentation for the
[https://docs.djangoproject.com/en/dev/ref/templates/builtins/#std
:templatefilter-date date] and
[https://docs.djangoproject.com/en/dev/ref/templates/builtins/#std
:templatefilter-time time] filters doesn't explain how to escape a format
character.
It's only documented as part of the
[https://docs.djangoproject.com/en/dev/ref/templates/builtins/#std
:templatetag-now now] template tag:
Note that you can backslash-escape a format string if you want to use
the “raw” value. In this example, both “o” and “f” are backslash-escaped,
because otherwise each is a format string that displays the year and the
time, respectively:
It is the {% now "jS \o\f F" %}
This would display as “It is the 4th of September”.
Historically, the big table with all the available format characters used
to be next to the documentation for `{% now %}` but it was moved at some
point (to be with the documentation for `|date`.
I would suggest moving the paragraph about backslash escape under the
table of all formats instead (or least duplicating it there too).
--
Ticket URL: <https://code.djangoproject.com/ticket/31006>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/052.3378cafe0658520552f1a0274fd1c502%40djangoproject.com.