I think I'm +1.  This seems to add some signal with zero noise.
On Apr 11, 2014 4:35 AM, "Gregor Müllegger" <[email protected]> wrote:

> Casting to strings would make this example work. But will break in other
> cases:
>
> dict((key, str(val)) for key, val in {'value': None}.items())
>   => <input value="None">
>
> I don't want to say that this problem is impossible to solve without a
> "is" check in the templates, I only want to point out that this basic
> comparison that is very handy in python on many ocassions is not available
> in the template. And having something like this in core might just make the
> template language a bit rounder and nicer to use for pythonistas.
>
> · Gregor ·
>
>
> 2014-04-11 7:44 GMT+02:00 Łukasz Rekucki <[email protected]>:
>
>> On 11 April 2014 01:11, Gregor Müllegger <[email protected]> wrote:
>> > Hi,
>> >
>> > thanks for your input. Unfortunatelly this would fail for int(0):
>>
>> Not if you encode all values to strings before passing to the
>> template, so it's "0" instead of 0.
>>
>> >
>> > {'value': 0} => <input value>
>> >
>> > Gregor
>> >
>> >
>> > 2014-04-10 11:41 GMT+02:00 Tino de Bruijn <[email protected]>:
>> >
>> >> Wouldn't this be easier?:
>> >>
>> >> {'required': "", 'name': 'fieldname'} => <input required
>> name="fieldname"
>> >> />
>> >>
>> >> {% for name, value in attrs.items %} {{ name }}{% if value %}="{{ value
>> >> }}"{% endif %}{% endfor %}
>> >>
>> >>
>> >> Tino
>> >>
>>
>> --
>> Łukasz Rekucki
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django developers" 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].
>> Visit this group at http://groups.google.com/group/django-developers.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-developers/CAEZs-EL%2BNqWuo-F6AkAWCBb5rn_7GKGXkfD35uyfF%2Bqbvss5Sw%40mail.gmail.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django developers" 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].
> Visit this group at http://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/CALjSGCNDMC1q7LhamQaf%3D9jEW0bXPn5gdpmDL88dVQgKsNb__Q%40mail.gmail.com<https://groups.google.com/d/msgid/django-developers/CALjSGCNDMC1q7LhamQaf%3D9jEW0bXPn5gdpmDL88dVQgKsNb__Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAMGywB7SbmgLE-Tp0qDw6kUsOJFi6%3D-32RMGkq_zn-kd%2Bh%3DeqQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to