#31006: Document how to escape a date/time format character for the |date and |time filters. -------------------------------------+------------------------------------- Reporter: Baptiste Mispelon | Owner: Ryan Type: | Cheley Cleanup/optimization | Status: assigned Component: Documentation | Version: master Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 1 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 1 | UI/UX: 0 -------------------------------------+------------------------------------- Changes (by felixxm):
* has_patch: 0 => 1 Old description: > 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). New description: 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#comment:4> 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 django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/067.1594bc26e232af25ba96b07825e644c1%40djangoproject.com.