Login

Snippets by bram

Snippet List

drupal7 password check

Completely based on [snippet 2729](http://djangosnippets.org/snippets/2729/) (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...

  • password
  • hash
  • drupal7
Read More

invalidation of cache-template-tag cache

this function invalidates a template-fragment cache bit. say you have: {% load cache %} {% cache 600 user_cache user.id %} something expensive here {% endcache %} maybe you want to force an update. With this function you can, just call: invalidate_template_cache("user_cache", user.id)

  • template
  • cache
  • invalidate
Read More

models with order (+admin editing)

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. One problem is that if the user sorts by another row, the up and down links are still there, but now don't make a lot of sense.

  • models
  • admin
  • order
Read More

Pledgie data parser

This one uses - and is very similar to - http://www.djangosnippets.org/snippets/852/ It gets the data from a pledgie.com campaign and parses it.

  • pledgie
  • donation
  • parser
Read More

phpbb (2.x) authentication backend

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.

  • authentication
  • backend
  • phpbb
Read More

Parsed RSS into template var

loads a parsed RSS feed (with feedparser) into a variable of choice. Caching by the "cache" template tag.

  • template
  • tag
  • templatetag
  • cache
  • rss
  • parse
Read More

Adding a field to a newform in __init__

When adding fields in the __init__ of a newform, and you don't want the fields to be added *after* 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!

  • newforms
  • field
  • init
Read More

bram has posted 7 snippets.