<?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>Diego Búrigo Zacarão's Weblog &#187; Django</title>
	<atom:link href="http://diegobz.net/category/django/feed/" rel="self" type="application/rss+xml" />
	<link>http://diegobz.net</link>
	<description>Let me talk about something</description>
	<lastBuildDate>Sat, 17 Jul 2010 23:22:09 +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>Django reverse with JavaScript</title>
		<link>http://diegobz.net/2010/07/16/django-reverse-with-javascript/</link>
		<comments>http://diegobz.net/2010/07/16/django-reverse-with-javascript/#comments</comments>
		<pubDate>Fri, 16 Jul 2010 21:06:39 +0000</pubDate>
		<dc:creator>diegobz</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Transifex]]></category>

		<guid isPermaLink="false">http://diegobz.net/?p=336</guid>
		<description><![CDATA[Taking the cobwebs out of here… Here I go to cite a way that can &#8216;solve&#8217; the URL reversing problem when you are using a Django app that uses some JavaScript and Ajax requests. Django has a very nice way to resolve URLs based on its name and optionally some args. It uses the regex [...]]]></description>
			<content:encoded><![CDATA[<p>Taking the cobwebs out of here…</p>
<p>Here I go to cite a way that can &#8216;solve&#8217; the URL reversing problem when you are using a Django app that uses some JavaScript and Ajax requests.</p>
<p>Django has a very nice way to resolve URLs based on its name and optionally some args. It uses the regex pattern defined in the related urls.py file of the given app. Example:</p>
<blockquote><p>from django.core.urlresolvers import reverse</p>
<p>reverse(&#8216;project_detail&#8217;, args=['foo'])<br />
&#8216;/projects/p/foo/&#8217;</p>
<p>reverse(&#8216;project_detail&#8217;, args=['bar'])<br />
&#8216;/projects/p/bar/&#8217;</p></blockquote>
<p>The problem turns when you want to make a Ajax request based on some dynamic data from a form or something. As some URLs sometimes need arguments to be resolved, we can&#8217;t always pre-reverse and attach them to the Context, on the Django response.</p>
<p>For the record, I found an alternative <a href="http://stackoverflow.com/questions/2724383/dry-urls-in-django-javascript" target="_blank">here</a>. With it you can take the args from the browser and request through Ajax to Django the resolved URL. It&#8217;s pretty cool, but I think it was a bit expensive to multiply by 2 the number of requests to the server.</p>
<p>It made me think on another approach, where I would pre-fill in the Context response of Django, the URL already resolved, but with named args like, %(project)s, for the required arguments. I ended up with this:</p>
<blockquote><p>from django.core.urlresolvers import get_resolver</p>
<p>def get_url_pattern(urlname):<br />
&#8220;&#8221;"<br />
Return pattern for an URL based on its name.</p>
<p>&gt;&gt;&gt; get_url_pattern(&#8216;project_deails&#8217;)<br />
u&#8217;/projects/p/%(project_slug)s/&#8217;</p>
<p>&#8220;&#8221;"<br />
return &#8216;/%s&#8217; % get_resolver(None).reverse_dict.get(urlname)[0][0][0]</p></blockquote>
<p>As you can notice, passing an URL name to that function will give you the resolved URL with named args. I&#8217;m not really aware about corner cases, so feel free to give any comment on it.</p>
<p>Once you have the URL as a string with named args, you can use this <a href="http://plugins.jquery.com/project/printf" target="_blank">JQuery plugin</a>, to resolve the named args using only JavaScript in the client side.</p>
<p>&#8230; and that&#8217;s it! <img src='http://diegobz.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://diegobz.net/2010/07/16/django-reverse-with-javascript/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Running Transifex with PostgreSQL on Fedora</title>
		<link>http://diegobz.net/2009/11/22/running-transifex-with-postgresql-on-fedora/</link>
		<comments>http://diegobz.net/2009/11/22/running-transifex-with-postgresql-on-fedora/#comments</comments>
		<pubDate>Sun, 22 Nov 2009 20:02:57 +0000</pubDate>
		<dc:creator>diegobz</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Transifex]]></category>

		<guid isPermaLink="false">http://diegobz.net/?p=257</guid>
		<description><![CDATA[Steps with sudo command configured to the current user: $ sudo yum install postgresql-server python-psycopg2 $ sudo service postgresql initdb Initializing database: [ OK ] $ sudo service postgresql start Starting postgresql service: [ OK ] $ sudo su &#8211; postgres -bash-4.0$ psql postgres=# CREATE USER transifex WITH PASSWORD &#8216;transifex&#8217;; CREATE ROLE postgres=# CREATE DATABASE [...]]]></description>
			<content:encoded><![CDATA[<p>Steps with sudo command configured to the current user:</p>
<blockquote><p>$ sudo yum install postgresql-server python-psycopg2</p>
<p>$ sudo service postgresql initdb<br />
Initializing database:                                     [  OK  ]</p>
<p>$ sudo service postgresql start<br />
Starting postgresql service:                           [  OK  ]</p>
<p>$ sudo su &#8211; postgres</p>
<p>-bash-4.0$ psql</p>
<p>postgres=# CREATE USER transifex WITH PASSWORD &#8216;transifex&#8217;;<br />
CREATE ROLE</p>
<p>postgres=# CREATE DATABASE transifex OWNER transifex;<br />
CREATE DATABASE</p>
<p>postgres=# \q</p>
<p>-bash-4.0$ exit</p>
<p>$ sudo vim /var/lib/pgsql/data/pg_hba.conf</p>
<p># &#8220;local&#8221; is for Unix domain socket connections only<br />
local   transifex   transifex                      password    # Add this line<br />
local   all            all                               ident</p>
<p>$ sudo service postgresql restart</p>
<p>$ psql transifex transifex<br />
Password for user transifex:<br />
psql (8.4.1)<br />
Type &#8220;help&#8221; for help.</p>
<p>transifex=&gt;</p>
<p>transifex=&gt; \q</p>
<p># Bellow it assumes the Tx code is under ~/workspace/mainline/ and<br />
# all the dependencies are installed. http://docs.transifex.org/intro/install.html</p>
<p>$ cd workspace/mainline/transifex/</p>
<p>$ vim settings/21-engines.conf</p>
<p># Database configuration<br />
DATABASE_ENGINE = &#8216;postgresql_psycopg2&#8242;<br />
DATABASE_NAME = &#8216;transifex&#8217;<br />
DATABASE_USER = &#8216;transifex&#8217;<br />
DATABASE_PASSWORD = &#8216;transifex&#8217;</p>
<p>$ ./manage.py syncdb</p>
<p>$ ./manage.py migrate codebases  # It shouldn&#8217;t be necessary :/</p>
<p>$ ./manage.py migrate</p>
<p>$ ./manage.py loaddata txcommon/fixtures/*</p>
<p>$ ./manage.py runserver 8080</p></blockquote>
<p>That&#8217;s it!</p>
]]></content:encoded>
			<wfw:commentRss>http://diegobz.net/2009/11/22/running-transifex-with-postgresql-on-fedora/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unicode usernames in Django admin panel</title>
		<link>http://diegobz.net/2009/11/10/unicode-usernames-in-django-admin-panel/</link>
		<comments>http://diegobz.net/2009/11/10/unicode-usernames-in-django-admin-panel/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 14:10:43 +0000</pubDate>
		<dc:creator>diegobz</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Transifex]]></category>

		<guid isPermaLink="false">http://diegobz.net/?p=243</guid>
		<description><![CDATA[This week we&#8217;ve gotten a request from translate.moblin.org for being able to login using unicode chars. They use a custom backend for authentication that allows, for example, Chinese chars in the username. Django seems to handle it pretty well, although the Django Admin Panel complains about it. As a solution, we&#8217;ve implemented a way to [...]]]></description>
			<content:encoded><![CDATA[<p>This week we&#8217;ve gotten a request from <a href="http://translate.moblin.org/" target="_blank">translate.moblin.org</a> for being able to login using unicode chars. They use a custom backend for authentication that allows, for example, Chinese chars in the username. Django seems to handle it pretty well, although the Django Admin Panel complains about it. As a solution, we&#8217;ve implemented a way to override the Django admin forms for creating and editing users, using a UnicodeRegexField.</p>
<p>That was a cool stuff. Here is a code example of an <a href="http://diegobz.net/wp-content/uploads/2009/11/admin.txt" target="_blank">admin.py</a></p>
]]></content:encoded>
			<wfw:commentRss>http://diegobz.net/2009/11/10/unicode-usernames-in-django-admin-panel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Becoming a package maintainer for Fedora</title>
		<link>http://diegobz.net/2009/08/19/becoming-a-package-maintainer-for-fedora/</link>
		<comments>http://diegobz.net/2009/08/19/becoming-a-package-maintainer-for-fedora/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 21:25:12 +0000</pubDate>
		<dc:creator>diegobz</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Transifex]]></category>

		<guid isPermaLink="false">http://diegobz.net/?p=159</guid>
		<description><![CDATA[This past week I became a packager for Fedora. It&#8217;s been a long time I would like to learn how to do it and I took the new dependencies of the upcoming Transifex 0.7, as an opportunity to make it happen. I started with packages very simple to be packaged. Actually they were more or [...]]]></description>
			<content:encoded><![CDATA[<p>This past week I became a packager for Fedora. It&#8217;s been a long time I would like to learn how to do it and I took the new dependencies of the upcoming Transifex 0.7, as an opportunity to make it happen.</p>
<p style="text-align: left;"><img class="attachment wp-att-167   alignleft" src="http://diegobz.net/wp-content/uploads/2009/08/rpm-package-fedora1.png" alt="rpm-package-fedora1" width="135" height="128" />I started with packages very simple to be packaged. Actually they were more or less only small Python apps based on Django, but I guess it was a good start.</p>
<p style="text-align: left;">One thing that I found very good was the <a href="https://fedoraproject.org/wiki/PackageMaintainers/Join" target="_blank">Fedora documentation for joining as a package maintainer</a>. I just needed to follow the instructions there and everything went well. If you are planning to become a Fedora packager as well, that page is definitely where you should start.</p>
<p>FWIW, I&#8217;ve taken some packages as owner and co-owner so far: <a href="https://admin.fedoraproject.org/pkgdb/users/packages/diegobz" target="_blank">https://admin.fedoraproject.org/pkgdb/users/packages/diegobz</a></p>
<p>Cool <img src='http://diegobz.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://diegobz.net/2009/08/19/becoming-a-package-maintainer-for-fedora/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Transifex 0.7 &#8211; Pyro is coming soon</title>
		<link>http://diegobz.net/2009/08/18/transifex-0-7-is-coming-soon/</link>
		<comments>http://diegobz.net/2009/08/18/transifex-0-7-is-coming-soon/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 02:06:44 +0000</pubDate>
		<dc:creator>diegobz</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Transifex]]></category>

		<guid isPermaLink="false">http://diegobz.net/?p=143</guid>
		<description><![CDATA[Pyro of the X-Men In the last weeks we have been polishing the development branch of Transifex for releasing the newest version of the hottest tool for management of translations in the world. If my father was here, next to me, he would say: &#8216;Ok, less&#8217;. Anyway, the truth is that we are quite excited [...]]]></description>
			<content:encoded><![CDATA[<div class="imageframe alignright" style="width: 161px;"><img class="attachment wp-att-148" src="http://diegobz.net/wp-content/uploads/2009/08/Pyro_St._John_Allerdyce.thumbnail.png" alt="Pyro" width="161" height="200" /></p>
<div class="imagecaption" style="text-align: center;"><a href="http://en.wikipedia.org/wiki/Pyro_(comics)" target="_blank">Pyro</a> of the <a title="X-Men" href="http://en.wikipedia.org/wiki/X-Men" target="_blank">X-Men</a></div>
</div>
<p>In the last weeks we have been polishing the development branch of Transifex for releasing the newest version of the hottest tool for management of translations in the world. <img src='http://diegobz.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  If my father was here, next to me, he would say: &#8216;Ok, less&#8217;.</p>
<p>Anyway, the truth is that we are quite excited with the upcoming 0.7 release. We got two Release Candidates in the past days and thankfully we got very good feedback from XFCE, Moblin, Django and Fedora guys. The #transifex channel on IRC (freenode.net) is all about good feelings. A lot of activities and discussions among bugs, enhancements and new features are going there, besides of very cool and helpful guys hanging around.</p>
<p>Do you wanna try out the latest code of the upcoming Transifex 0.7? You are invited to <a title="Transifex Appliance" href="http://www.rpath.org/web/project/transifex/release?id=6497" target="_blank">download an image of our appliance</a> which is a whole server that can be executed in a virtual environment and, of course, report things out in our <a href="http://transifex.org/newticket" target="_blank">ticket system</a>, once you find any. Og Maciel has been a hero keeping up an appliance of the development branch with daily updates. Thank you, Og!</p>
<p>By the way, for having a preview of what is new in this next release, you can see the <a href="http://docs.transifex.org/releases/0.7.html#transifex-0-7-pyro-release-candidate-2" target="_blank">0.7RC2 Release Notes</a>. <img src='http://diegobz.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://diegobz.net/2009/08/18/transifex-0-7-is-coming-soon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
