#26606: 'string_if_invalid' option does not work with custom filter
-------------------------------------+-------------------------------------
Reporter: JosephDev | Owner: nobody
Type: Bug | Status: new
Component: Template system | Version: 1.9
Severity: Normal | Resolution:
Keywords: template, custom | Triage Stage:
template filter | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by JosephDev):
"string_if_invalid" option works perfectly with context variables,
however, with request parameters, it makes redundant code.
Actually, I am supposed to get null string ("") when I don't need string
of "string_if_invalid" especially handle request parameters.
for example, to get null string (or to escape invalid string)
as is
{{{
<input name="foo" type="text" value="{% if request.GET.foo %}{{
request.GET.foo }}{% endif %}">
}}}
want to
{{{
<input name="foo" type="text" value="{{ request.GET.foo|or_null }}">
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26606#comment:5>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/067.9dbecf1ab2776c908b9bc0a18aca9db5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.