djangosnippets.org: Latest snippets posted by JoeLinuxhttp://djangosnippets.org/users/JoeLinux/2013-03-15T14:26:29.005881-05:00JoeLinuxAutocomplete TextInput Widget w/ Static Data (jQuery UI)
2013-03-15T14:26:29.005881-05:00JoeLinuxhttp://djangosnippets.org/snippets/2901/<p>Custom form widget for rendering an autocomplete (using jQuery UI's autocomplete widget) text input in a template.</p>
<p>This arose from the need to have all fields asking for a state to use autocomplete, so I decided to make this.</p>
Freely redistributableGravatar support in model save override
2013-02-18T05:57:44.396894-06:00JoeLinuxhttp://djangosnippets.org/snippets/2894/<p>Overridden save() method that adds Gravatar support for a user with a profile photo field (and presumably an email field). Checks to see if user has provided a photo. If not, then query Gravatar for a possible photo. Finally, if Gravatar does not have an appropriate photo for this user, …</p>
Freely redistributableRetrieve human-readable value from choices tuple or value from dict
2013-02-07T11:46:49.526971-06:00JoeLinuxhttp://djangosnippets.org/snippets/2890/<p>Will help you retrieve the value from a dictionary with a supplied key, or the human-readable value from a choices tuple. Works as follows:</p>
<p>To retrieve the value of a dict:
<code>{{ crime_rates_dict|getval:"Chicago" }}</code> <-- will return value of <code>crime_rates_dict["Chicago"]</code></p>
<pre><code>To retrieve the human-readable value from a choices tuple:
`{{ …</code></pre>
Freely redistributable