<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>mikhail panchenko / blog &#187; context processors</title>
	<atom:link href="http://mihasya.com/blog/tag/context-processors/feed/" rel="self" type="application/rss+xml" />
	<link>http://mihasya.com/blog</link>
	<description>good things now come in packages of three</description>
	<lastBuildDate>Thu, 22 Mar 2012 21:08:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Django: exposing settings in templates, the easy way</title>
		<link>http://mihasya.com/blog/django-exposing-settings-in-templates-the-easy-way/</link>
		<comments>http://mihasya.com/blog/django-exposing-settings-in-templates-the-easy-way/#comments</comments>
		<pubDate>Sun, 26 Jul 2009 21:08:00 +0000</pubDate>
		<dc:creator>mihasya</dc:creator>
				<category><![CDATA[dev]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[context processors]]></category>
		<category><![CDATA[settings]]></category>

		<guid isPermaLink="false">http://mihasya.com/blog/?p=285</guid>
		<description><![CDATA[NOTE: I have submitted a patch to have this functionality as part of Django core. I&#8217;m posting this code here in case the patch gets rejected, since similar motions have previously been rejected. The ticket is at http://code.djangoproject.com/ticket/3818, and I will update this post if the patch gets accepted. I find it very handy to [...]]]></description>
			<content:encoded><![CDATA[<p><strong>NOTE: I have submitted a patch to have this functionality as part of Django core. I&#8217;m posting this code here in case the patch gets rejected, since similar motions have previously been rejected. The ticket is at <a title="Django Ticket 3818" href="http://code.djangoproject.com/ticket/3818">http://code.djangoproject.com/ticket/3818</a>, and I will update this post if the patch gets accepted.</strong></p>

<p>I find it very handy to be able to expose parts of settings.py in templates. The Django docs show you how to do this using context processors and give the code for the MEDIA_URL context processor here. However, it seems silly to me to have to write custom processors all the time. Instead, I propose a single processor that exposes a list of settings (stored in settings.py itself) to the template layer.</p>

<p>The gist containing the code is here: <a title="Gist for settings context processor" href="http://gist.github.com/155894">http://gist.github.com/155894</a></p>

<p>Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://mihasya.com/blog/django-exposing-settings-in-templates-the-easy-way/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

