djangosnippets.org: Latest snippets posted by bramhttps://djangosnippets.org/users/bram/2012-06-22T09:51:32.041580-05:00bramdrupal7 password check
2012-06-22T09:51:32.041580-05:00bramhttps://djangosnippets.org/snippets/2777/<p>Completely based on <a href="http://djangosnippets.org/snippets/2729/">snippet 2729</a> (see that snippet for useful comments!).
The above snippet did not work for me (something with MemoryError), so I looked at the Drula source code and reimplemented...</p>
Freely redistributableinvalidation of cache-template-tag cache
2009-06-24T09:50:45.427271-05:00bramhttps://djangosnippets.org/snippets/1593/<p>this function invalidates a template-fragment cache bit.</p>
<p>say you have:</p>
<p>{% load cache %}
{% cache 600 user_cache user.id %}
something expensive here
{% endcache %}</p>
<p>maybe you want to force an update. With this function you can, just call:</p>
<p>invalidate_template_cache("user_cache", user.id)</p>
Freely redistributablemodels with order (+admin editing)
2008-08-22T07:18:43.789731-05:00bramhttps://djangosnippets.org/snippets/998/<p>Use this abstract model if you want to add "order" to a given model. Once you do, you will get automatic "up" and "down" links for each model row.
</p>
<p>One problem is that if the user sorts by another row, the up and down links are still there, but now …</p>
Freely redistributablePledgie data parser
2008-07-31T03:41:51.930417-05:00bramhttps://djangosnippets.org/snippets/931/<p>This one uses - and is very similar to - http://www.djangosnippets.org/snippets/852/</p>
<p>It gets the data from a pledgie.com campaign and parses it.</p>
Freely redistributablephpbb (2.x) authentication backend
2008-07-25T06:12:09.510592-05:00bramhttps://djangosnippets.org/snippets/915/<p>This class not only checks an old-style phpbb 2.x password, when the user successfully logs in, it rehashes the (correct) password in the newstyle hash and saves it. Eradicating the old, quite unsafe stored md5 password.</p>
Freely redistributableParsed RSS into template var
2008-07-04T05:51:12.287795-05:00bramhttps://djangosnippets.org/snippets/852/<p>loads a parsed RSS feed (with feedparser) into a variable of choice. Caching by the "cache" template tag.</p>
Freely redistributableAdding a field to a newform in __init__
2007-05-15T06:43:25.800183-05:00bramhttps://djangosnippets.org/snippets/237/<p>When adding fields in the <strong>init</strong> of a newform, and you don't want the fields to be added <em>after</em> the class-attribute fields, this is a possibility... This is a bad example as the email_from could just as well have been defined as a class variable!</p>
Freely redistributable