<?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>Django Dev</title>
	<atom:link href="http://django-dev.com/feed" rel="self" type="application/rss+xml" />
	<link>http://django-dev.com</link>
	<description>About Django development</description>
	<lastBuildDate>Sun, 20 Jun 2010 18:23:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Accept template tags in Django Flatpages</title>
		<link>http://django-dev.com/accept-template-tags-in-django-flatpages-2010-06</link>
		<comments>http://django-dev.com/accept-template-tags-in-django-flatpages-2010-06#comments</comments>
		<pubDate>Sun, 20 Jun 2010 18:23:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[flatpages]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[templatetag]]></category>

		<guid isPermaLink="false">http://django-dev.com/?p=16</guid>
		<description><![CDATA[You need to use template tags in Django FlatPages application ? Here is a solution: First create an evaluate_tag.py file in your templatetags directory with the following content: [python] from django import template register = template.Library() @register.tag(name="evaluate") def do_evaluate(parser, token):     """     tag usage {% evaluate object.textfield %}     """   [...]]]></description>
			<content:encoded><![CDATA[<p>You need to use template tags in <a href="http://docs.djangoproject.com/en/dev/ref/contrib/flatpages/">Django FlatPages</a> application ?</p>
<p>Here is a solution:</p>
<p>First create an <strong>evaluate_tag.py</strong> file in your <strong>templatetags </strong>directory with the following content:</p>
<pre><code>
[python]
from django import template

register = template.Library()

@register.tag(name="evaluate")
def do_evaluate(parser, token):
    """
    tag usage {% evaluate object.textfield %}
    """
    try:
        tag_name, variable = token.split_contents()
    except ValueError:
        raise template.TemplateSyntaxError, "%r tag requires a single argument" % token.contents.split()[0]
    return EvaluateNode(variable)

class EvaluateNode(template.Node):
    def __init__(self, variable):
        self.variable = template.Variable(variable)

    def render(self, context):
        try:
            content = self.variable.resolve(context)
            t = template.Template(content)
            return t.render(context)
        except template.VariableDoesNotExist, template.TemplateSyntaxError:
            return 'Error rendering', self.variable
[/python]
</code></pre>
<p>Next, modifiy your flatpages template file to use this template tag:</p>
<p>[html]</p>
<p>&lt;!DOCTYPE HTML PUBLIC &#8220;-//W3C//DTD HTML 4.0 Transitional//EN&#8221;<br />
&#8220;http://www.w3.org/TR/REC-html40/loose.dtd&#8221;&gt;<br />
&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;title&gt;{{ flatpage.title }}&lt;/title&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
{% load evaluate_tag %}<br />
{% evaluate flatpage.content %}<br />
&lt;/body&gt;<br />
&lt;/html&gt;</p>
<p>[/html]</p>
<p>Now, you can use template tags in your flatpages !</p>
]]></content:encoded>
			<wfw:commentRss>http://django-dev.com/accept-template-tags-in-django-flatpages-2010-06/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Django 1.2.1 – CSRF verification failed &#8211; 403 Error</title>
		<link>http://django-dev.com/django-1-2-1-%e2%80%93-csrf-verification-failed-403-error-2010-06</link>
		<comments>http://django-dev.com/django-1-2-1-%e2%80%93-csrf-verification-failed-403-error-2010-06#comments</comments>
		<pubDate>Tue, 08 Jun 2010 17:52:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[CSRF]]></category>

		<guid isPermaLink="false">http://django-dev.com/?p=8</guid>
		<description><![CDATA[Here is the kind of error you can get while attempting to make a POST request after migrating to Django 1.2.1: 403 Forbidden CSRF verification failed. Request aborted. Help Reason given for failure: CSRF cookie not set. To correct this, all you have to do is to add  &#8216;django.middleware.csrf.CsrfViewMiddleware&#8217;, and &#8216;django.middleware.csrf.CsrfResponseMiddleware&#8217; to your MIDDLEWARE_CLASSES in [...]]]></description>
			<content:encoded><![CDATA[<p>Here is the kind of error you can get while attempting to make a POST request after migrating to Django 1.2.1:</p>
<p><code>403 Forbidden</code><br />
<code>CSRF verification failed. Request aborted.<br />
 Help</code><br />
<code>Reason given for failure:</code><br />
<code>CSRF cookie not set.</code></p>
<p>To correct this, all you have to do is to add  &#8216;django.middleware.csrf.CsrfViewMiddleware&#8217;, and &#8216;django.middleware.csrf.CsrfResponseMiddleware&#8217; to your <code>MIDDLEWARE_CLASSES</code>  in your settings.py file.</p>
<p><code>MIDDLEWARE_CLASSES = (<br />
...<br />
'django.contrib.sessions.middleware.SessionMiddleware',<br />
'django.middleware.csrf.CsrfViewMiddleware',<br />
'django.middleware.csrf.CsrfResponseMiddleware',<br />
...<br />
)</code></p>
]]></content:encoded>
			<wfw:commentRss>http://django-dev.com/django-1-2-1-%e2%80%93-csrf-verification-failed-403-error-2010-06/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Django 1.2 just released</title>
		<link>http://django-dev.com/django-1-2-just-released-2010-05</link>
		<comments>http://django-dev.com/django-1-2-just-released-2010-05#comments</comments>
		<pubDate>Thu, 20 May 2010 13:34:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://django-dev.com/?p=5</guid>
		<description><![CDATA[Here are the new features.]]></description>
			<content:encoded><![CDATA[<p>Here are the <a href="http://docs.djangoproject.com/en/dev/releases/1.2/">new features</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://django-dev.com/django-1-2-just-released-2010-05/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Welcome to Django Dev</title>
		<link>http://django-dev.com/hello-world-2010-04</link>
		<comments>http://django-dev.com/hello-world-2010-04#comments</comments>
		<pubDate>Thu, 29 Apr 2010 19:06:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[django]]></category>

		<guid isPermaLink="false">http://django-dev.com/?p=1</guid>
		<description><![CDATA[Just a new blog about Django development : generic code, test driven development, internationalization&#8230;]]></description>
			<content:encoded><![CDATA[<p>Just a new blog about Django development : generic code, test driven development, internationalization&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://django-dev.com/hello-world-2010-04/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
