djangosnippets.org: Latest snippets posted by deadwisdomhttp://djangosnippets.org/users/deadwisdom/2009-06-01T22:59:57.973509-05:00deadwisdomSometimes Tag
2009-06-01T22:59:57.973509-05:00deadwisdomhttp://djangosnippets.org/snippets/1545/<p>Adds a templatetag that works like an if block, but . The one and only argument is a float that reflects the percentage chance. It defaults to .2, %20.</p>
<p>{% sometimes %}
<img src='spy_behind_sniper.jpg'/>
{% else %}
<img src='sniper.jpg'/>
{% endsometimes %}</p>
<p>-- or --</p>
<p>{% sometimes .001 %}
You …</p>
Freely redistributableJSONField
2007-08-21T12:07:57.732506-05:00deadwisdomhttp://djangosnippets.org/snippets/377/<p>This is a great way to pack extra data into a model object, where the structure is dynamic, and not relational. For instance, if you wanted to store a list of dictionaries. The data won't be classically searchable, but you can define pretty much any data construct you'd like, as …</p>
Freely redistributable