Skip to content

Instantly share code, notes, and snippets.

@skyl skyl/gist:1961812
Created Mar 2, 2012

Embed
What would you like to do?
Which is actually cleaner? (django templates)
{% exec %}
try:
f = durs[duration]
f.field.widget.attrs['placeholder'] = duration
print f
except KeyError:
pass
{% endexec %}
OR
{% with durs|get:duration as f %}
{% with "placeholder:"|add:duration as placeholder %}
{{ f|attr:placeholder }}
{% endwith %}
{% endwith %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.