<?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>Victorelu &#187; python</title>
	<atom:link href="http://victorelu.com/tag/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://victorelu.com</link>
	<description>Romanian studying in Aarhus</description>
	<lastBuildDate>Wed, 30 Jun 2010 21:33:29 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Comparing string with integer in Django&#8217;s template</title>
		<link>http://victorelu.com/comparing-string-with-integer-in-djangos-template/</link>
		<comments>http://victorelu.com/comparing-string-with-integer-in-djangos-template/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 15:12:13 +0000</pubDate>
		<dc:creator>Victor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[internship]]></category>
		<category><![CDATA[job]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://victorelu.com/?p=782</guid>
		<description><![CDATA[As you can&#8217;t change the type of variable straight when working inside a Django template and you can only do it to the variables going TO the template, I found a stupid work around it.
Say you have variable a = &#8216;2&#8242; and b = 2 and you want to compare them. The way I did [...]]]></description>
			<content:encoded><![CDATA[<p>As you can&#8217;t change the type of variable straight when working inside a Django template and you can only do it to the variables going TO the template, I found a stupid work around it.</p>
<p>Say you have variable a = &#8216;2&#8242; and b = 2 and you want to compare them. The way I did it was adding the same value to both variables, thus changing the string variable into an integer by adding a filter. Might not be the best solution in the world but it worked.</p>
<pre><strong>Not working</strong>:
{% ifequal a b %}
HTML stuff 'round here
{% endifequal%}

<strong>Working</strong>:
{% ifequal a|add:"0" b|add:"0" %}
HTML stuff 'round here
{% endifequal %}</pre>
<p>It does look a little bit silly but it might do the trick if you&#8217;re too lazy to change your views/models.</p>
]]></content:encoded>
			<wfw:commentRss>http://victorelu.com/comparing-string-with-integer-in-djangos-template/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
