#37118: Support variables in the {% now %} template tag
----------------------+-------------------------------------------
     Reporter:  Lily  |                     Type:  New feature
       Status:  new   |                Component:  Template system
      Version:  6.0   |                 Severity:  Normal
     Keywords:        |             Triage Stage:  Unreviewed
    Has patch:  0     |      Needs documentation:  0
  Needs tests:  0     |  Patch needs improvement:  0
Easy pickings:  0     |                    UI/UX:  0
----------------------+-------------------------------------------
 This was discussed and accepted in https://github.com/django/new-
 features/issues/115.

 Allow passing a variable from the template context into the `{% now %}`
 template tag to allow dynamically choosing the formatting.

 [https://docs.djangoproject.com/en/6.0/ref/templates/builtins/#now
 Django's `{% now %}` template tag] currently only supports a hardcoded
 string format defined directly in the template, or one of a small number
 of specific settings. By supporting template variables, it would be
 possible to change the `format` dynamically (for example, based on a
 user's locale).

 [https://blog.lilyf.org/posts/django-template-quirks-3/#the--now--tag As I
 explain in my blog post], the `now` tag has some very weird behaviour
 caused by assuming the `format` will always be a string. By expanding to
 support variables, we can also clean up these weird edge-cases by raising
 a `TemplateSyntaxError`.

 Several other template tags support variables, so it should be fairly easy
 to reuse their implementation of this.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/37118>
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 visit 
https://groups.google.com/d/msgid/django-updates/0107019e51768baf-80c57eb2-c8b8-46ac-8a82-099228e3f9c4-000000%40eu-central-1.amazonses.com.

Reply via email to