djangosnippets.org: Latest snippets posted by jerzykhttp://djangosnippets.org/users/jerzyk/2007-12-11T06:06:34.430878-06:00jerzykprevent GET or POST requests
2007-12-11T06:06:34.430878-06:00jerzykhttp://djangosnippets.org/snippets/505/<p>This will return HTTP 405 if request was not POSTed.
same way you can forbide POST request, change 'POST' to 'GET'
</p>
<p>Decorators provided for your convenience.
</p>
Freely redistributableblocksetter
2007-12-10T11:21:22.125956-06:00jerzykhttp://djangosnippets.org/snippets/503/<p>Sometimes you need to set a little bit more complex variable in the template (e.g. Title), that is being used more than once.
this simple tag defines "blockset" tag.
{% blockset variable-name %}{%endblockset}
everything inside body (between blockset/endblockset) is being assigned to the variable "variable-name".</p>
<p>I have found this quite …</p>
Freely redistributableCache Manager
2007-12-10T11:13:50.999300-06:00jerzykhttp://djangosnippets.org/snippets/502/<p>I had a problem: too many fetches from the DB.
So, how to reduce load on the database without major changes to the code?
Cache Manager is the answer. I've managed to reduce number of DB hits as much as 80% in some cases (dictionaries, complex relations). It is using …</p>
Freely redistributable