djangosnippets.org: Latest snippets tagged with 'processor'https://djangosnippets.org/tags/processor/2010-07-02T07:49:13.476033-05:00Use MEDIA_URL in flatpages with SSL
2010-07-02T07:49:13.476033-05:00gobblehttps://djangosnippets.org/snippets/2089/<p>This is a copy of <a href="http://djangosnippets.org/snippets/654/">snippet 654</a>, modified to allow dynamic MEDIA_URL, as you might need that for SSL in combination with <a href="http://djangosnippets.org/snippets/1754/">snippet 1754</a>.</p>
<p>This is a template filter to enable the use of the MEDIA_URL setting in content from the
flatpages database table. It searches for {{ …</p>
Freely redistributableLoad static media from secure (SSL) static server (Context Processor)
2009-10-09T13:25:54.511785-05:00ianreardonhttps://djangosnippets.org/snippets/1754/<p>If you request static files such as images, javascript or css using http rather than https, the browser will complain that your site is not secure.<br />
</p>
<p>This simple context processor will replace http:// with https:// in your MEDIA_URL if your static files are being included from an https page.</p>
<p>In …</p>
Freely redistributableLetterbox for sorl-thumbnail
2009-04-07T15:11:55.510868-05:00Moggahttps://djangosnippets.org/snippets/1419/<p>This custom processor is meant for use with sorl-thumbnail to add letterboxing functionality.
Add to your THUMBNAIL_PROCESSORS like so:</p>
<p><code>THUMBNAIL_PROCESSORS = (
'sorl.thumbnail.processors.colorspace',
'sorl.thumbnail.processors.autocrop',
'sorl.thumbnail.processors.scale_and_crop',
'sorl.thumbnail.processors.filters',
# custom processors
'utils.processors.ltbx',
)</code></p>
<p>and then use in your templates like so:</p>
<p><code>{% thumbnail model.img_field 200x150 ltbx as thumb %}
<img src="{{ thumb …</code></p>
Freely redistributableDynamic Django settings context processor
2008-07-10T22:31:28.740699-05:00sciyoshihttps://djangosnippets.org/snippets/873/<p>Here's a nice way of easily passing only certain settings variables to the template. Because of the way Django looks up context processors, we need a little hack with sys.modules. The <a href="http://sciyoshi.com/blog/2008/jul/10/dynamic-django-settings-context-processor/">blog entry is here</a>.
</p>
Freely redistributable