<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0"><id>http://viktornagy.com/blog/</id><title>Nagy Viktor (V)</title><updated>2009-09-27T10:27:25Z</updated><link href="http://viktornagy.com/blog/" rel="alternate" /><author><name>V</name></author><generator version="r33" uri="http://code.google.com/p/django-atompub/">django-atompub</generator><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/NagyViktor/blog" /><feedburner:info uri="nagyviktor/blog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry><id>http://viktornagy.com/blog/2009/09/27/kep-ferfiakrol/</id><title type="html">Kép a férfiakról</title><updated>2009-09-27T10:27:25Z</updated><published>2009-09-27T10:24:50Z</published><category term="élmény" /><link href="http://viktornagy.com/blog/2009/09/27/kep-ferfiakrol/" rel="self" /><link href="http://feedproxy.google.com/~r/NagyViktor/blog/~3/LiG96BjCRR0/" rel="alternate" /><content type="html">&lt;p&gt;Néhány haveromat beválogatták egy filmforgatásra, ahol egy férfivá-avatást jásztanak majd el. Ehhez mindannyiuk haját kopaszra borotválják. Erről már a válogatáson is tudtak. Íme egy jelenet a borotválásból:
&lt;!--more--&gt;
Ma történt meg a kopaszra borotválás. Miközben kopasztott Magdi néni,
a következő párbeszédet sederintette le mögöttem. Jött egy másik srác,
és mondta, hogy őneki kéne a haja a hétvégére. Tudni kell, hogy kb
nullással volt körbenyírva, a fejtetőn meg 10 cm2-en 3mm hajkorona.
Magdi néni megkérdezte,&amp;nbsp;hogy:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Miért, most lesz a&amp;nbsp;lagzija?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A gyerek csak mondta, hogy igen most. Aztán kapott még a pofájába,
hogy akkor miért vállalta el stb, stb. De a&amp;nbsp;legjobb:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A férfiak mindenből mekkora problémát&amp;nbsp;csinálnak!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Itt már hangosan röhögtem, hogy ezt jól megkaptuk. A srác kezdte nem
érteni a ránehezedő nyomást, és magába roskadóan utolsó
próbálkozásként sértődötten odatette Magdi néninek,&amp;nbsp;hogy:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ezt majd én&amp;nbsp;eldöntöm.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Magdi néni, borotvált tovább, és ugyanazzal a lendülettel, alig alázva
a&amp;nbsp;srácot:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hát persze, hogy eldönti.&amp;nbsp;&amp;#8230;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Kicsit semmibe lett nézve a hisztijével együtt. Szóval jól állunk.
Férfivá avatásos forgatás, és fel sem merül senkiben, hogy valami
hibádzik. Mit jelenthetett férfinak lenni. Ma nincs ilyen szertartás,
mindenki férfi? Mi történt az elmút 2-3 ezer évben, hogy fodrász Magdi
néni csípőből kicsinál egy kis pöcst, aki annak idején valószínűleg
egy harcos férfi lett&amp;nbsp;volna.&lt;/p&gt;

&lt;p&gt;A skac meg ült a padon, mint egy tök, a kis sérójával, aztán
elkullogott.
Azt hiszem van még tennivaló. Mennyi férfit kell még legyártani, mire
ismét kialakul egy közfelfogás, hogy mit is jelent a férfi. Van&amp;nbsp;munka.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/4USYlAlFECy_sVImSn2fADpgRrY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/4USYlAlFECy_sVImSn2fADpgRrY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/4USYlAlFECy_sVImSn2fADpgRrY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/4USYlAlFECy_sVImSn2fADpgRrY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/NagyViktor/blog?a=LiG96BjCRR0:UYh3sZKhabs:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/NagyViktor/blog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/NagyViktor/blog?a=LiG96BjCRR0:UYh3sZKhabs:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/NagyViktor/blog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/NagyViktor/blog?a=LiG96BjCRR0:UYh3sZKhabs:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/NagyViktor/blog?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/NagyViktor/blog?a=LiG96BjCRR0:UYh3sZKhabs:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/NagyViktor/blog?i=LiG96BjCRR0:UYh3sZKhabs:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/NagyViktor/blog?a=LiG96BjCRR0:UYh3sZKhabs:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/NagyViktor/blog?i=LiG96BjCRR0:UYh3sZKhabs:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/NagyViktor/blog/~4/LiG96BjCRR0" height="1" width="1"/&gt;</content><feedburner:origLink>http://viktornagy.com/blog/2009/09/27/kep-ferfiakrol/</feedburner:origLink></entry><entry><id>http://viktornagy.com/blog/2009/09/15/vim-actually-seems-be-quite-nice-pythondjango-development/</id><title type="html">Vim actually seems to be quite nice for Python/Django development</title><updated>2009-09-15T02:05:40Z</updated><published>2009-09-15T01:10:39Z</published><category term="django" /><category term="settings" /><category term="vim" /><link href="http://viktornagy.com/blog/2009/09/15/vim-actually-seems-be-quite-nice-pythondjango-development/" rel="self" /><link href="http://feedproxy.google.com/~r/NagyViktor/blog/~3/AfMd2csb3dk/" rel="alternate" /><content type="html">&lt;p&gt;In the past days there was a quite nice discussion on &lt;a href="http://groups.google.com/group/django-users/browse_thread/thread/5a753dd76513652b?hl=en"&gt;Editors of choice&lt;/a&gt; on the list, and this encouraged me to give Vim another try. This time, it seems to be rather fruitful!
&lt;!--more--&gt;
My vim setup is stored online at &lt;a href="https://code.launchpad.net/~viktor-nagy/+junk/dotfiles"&gt;my Launchpad repo&lt;/a&gt;, feel free to check it&amp;nbsp;out.&lt;/p&gt;

&lt;p&gt;To get a quickstart I&amp;#8217;ve read what plugins others have recommended on the above list discussion, and in the &lt;a href="http://code.djangoproject.com/wiki/UsingVimWithDjango"&gt;Django Wiki on using Vim&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Whatever plugins you use, you might find my &lt;code&gt;djvim.py&lt;/code&gt; &lt;a href="http://bazaar.launchpad.net/~viktor-nagy/%2Bjunk/dotfiles/annotate/head%3A/bin/djvim.py"&gt;1&lt;/a&gt; script useful to start (g)vim ready for django development. Actually, it assumes omnicomplete as well, but I guess this is not a big&amp;nbsp;requirement.&lt;/p&gt;

&lt;p&gt;After, I have checked all the plugins and things that I could find on the two pages mentioned previously, finally decided to stay with the&amp;nbsp;following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://blog.fluther.com/blog/2008/10/17/django-vim/"&gt;omnicomplete&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.vim.org/scripts/script.php?script_id=2540"&gt;SnipMate&lt;/a&gt; and &lt;a href="http://github.com/robhudson/snipmate_for_django/tree/master"&gt;SnipMate for&amp;nbsp;django&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://vim.sourceforge.net/scripts/script.php?script_id=273"&gt;taglist.vim&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.vim.org/scripts/script.php?script_id=1487"&gt;django.vim&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.vim.org/scripts/script.php?script_id=2607"&gt;tasklist.vim&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.vim.org/scripts/script.php?script_id=301"&gt;xmledit.vim&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://github.com/scrooloose/nerdcommenter"&gt;nerd_commenter&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.vim.org/scripts/script.php?script_id=695"&gt;po.vim&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A short description of my settings related to each of them&amp;nbsp;follows. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;Omnicomplete&lt;/em&gt; allows code completion in python, javascript, etc. It&amp;#8217;s original key binding is &amp;lt;Ctrl-x&gt;&amp;lt;Ctrl-o&gt;, instead of &amp;lt;Ctrl-Space&gt; the one I&amp;#8217;m familiar with. As a result, I&amp;#8217;ve&amp;nbsp;added&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;imap &amp;lt;C-Space&amp;gt; &amp;lt;C-x&amp;gt;&amp;lt;C-o&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;to &lt;a href="http://bazaar.launchpad.net/~viktor-nagy/%2Bjunk/dotfiles/annotate/head%3A/vim/.vimrc"&gt;my .vimrc file&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;TagList&lt;/em&gt; also has some weird key bindings, and very long command names to type, so I&amp;#8217;ve defined &lt;F4&amp;gt; to toggle the list view&amp;nbsp;by&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;map &amp;lt;F4&amp;gt; :TlistToggle&amp;lt;CR&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It&amp;#8217;s worth noting that I did not manage to make TagList to automatically scan the files I open, so the djvim.py file takes care of this, and tells vim which directories to scan at startup. This is definitely not the nicest way to go, but good for a Vim&amp;nbsp;novice.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Besides installing these plugins, as I am a big fan of Eclipse&amp;#8217;s debugging with PyDev, I wrote &lt;a href="http://bazaar.launchpad.net/~viktor-nagy/%2Bjunk/dotfiles/annotate/head%3A/vim/.vim/plugin/django_commands.vim"&gt;my first Vim function&lt;/a&gt; to run the test suite. It is a rather simple script, and it&amp;#8217;s extremely non-interactive, but at least it is a first step. It basically runs ./manage.py test with the given application and the settings file you set at startup, and reads the output into a new&amp;nbsp;window.&lt;/p&gt;

&lt;p&gt;After spending a short day around Vim I really enjoy it, and will try to stick with it for a while. But there are still some shortcomings in which you might be able to help me&amp;nbsp;out.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;how can I set up taglist to automatically tag the files that I open for&amp;nbsp;editing?&lt;/li&gt;
&lt;li&gt;have a shortcut to start the development server. As Vim is not able to handle an interactive shell, this basically means to open a terminal and run the server in there, or regularly read to output of &lt;code&gt;./manage.py runserver&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;have shortcuts to other commands, like &lt;code&gt;shell_plus&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;make my extremely powerful &lt;code&gt;DJtest&lt;/code&gt; script able to jump to the code when there is an&amp;nbsp;error/failure&lt;/li&gt;
&lt;li&gt;have django.vim syntax set for every html file by&amp;nbsp;default&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you have any favourite settings, tweaks that I could use, please share them with me&amp;nbsp;below!&lt;/p&gt;

&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/SiNCrUszzFkrHBHEoEq8QZemW5E/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/SiNCrUszzFkrHBHEoEq8QZemW5E/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/SiNCrUszzFkrHBHEoEq8QZemW5E/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/SiNCrUszzFkrHBHEoEq8QZemW5E/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/NagyViktor/blog?a=AfMd2csb3dk:3JicGG2Z5wA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/NagyViktor/blog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/NagyViktor/blog?a=AfMd2csb3dk:3JicGG2Z5wA:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/NagyViktor/blog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/NagyViktor/blog?a=AfMd2csb3dk:3JicGG2Z5wA:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/NagyViktor/blog?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/NagyViktor/blog?a=AfMd2csb3dk:3JicGG2Z5wA:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/NagyViktor/blog?i=AfMd2csb3dk:3JicGG2Z5wA:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/NagyViktor/blog?a=AfMd2csb3dk:3JicGG2Z5wA:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/NagyViktor/blog?i=AfMd2csb3dk:3JicGG2Z5wA:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/NagyViktor/blog/~4/AfMd2csb3dk" height="1" width="1"/&gt;</content><feedburner:origLink>http://viktornagy.com/blog/2009/09/15/vim-actually-seems-be-quite-nice-pythondjango-development/</feedburner:origLink></entry><entry><id>http://viktornagy.com/blog/2009/07/18/getting-donations-paypal/</id><title type="html">Getting donations from PayPal</title><updated>2009-07-18T11:30:50Z</updated><published>2009-07-18T10:56:05Z</published><category term="django" /><category term="élmény" /><link href="http://viktornagy.com/blog/2009/07/18/getting-donations-paypal/" rel="self" /><link href="http://feedproxy.google.com/~r/NagyViktor/blog/~3/j4KEoUhi16E/" rel="alternate" /><content type="html">&lt;p&gt;During my trip in Bulgaria starting in a couple of weeks we will take part in a fund-raising mountain hiking for &lt;a href="http://www.karindom.org/"&gt;the Karin Dom foundation&lt;/a&gt;. As besides our participation we would like to help them financially as well we decided to put together a small website where friends and colleagues might sponsor us, so we can transfer their donations to Karin&amp;nbsp;Dom.&lt;/p&gt;

&lt;p&gt;To accomplish this task, I wrote a small django application, &lt;a href="https://launchpad.net/django-donation"&gt;&lt;em&gt;django-donation&lt;/em&gt;&lt;/a&gt;. This application let&amp;#8217;s you easily receive donations on your website, and tries to show some relevant information about your sponsors, like to total amount collected. Moreover, depending on the sponsors&amp;#8217; wishes you might show their name and donation as&amp;nbsp;well.&lt;/p&gt;

&lt;p&gt;During this work I have learned several&amp;nbsp;things:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Circumventing PayPal&amp;#8217;s security checks is a breeze (but still annoying to have to)&lt;/strong&gt; For the donation I thought I will need a &lt;em&gt;Business&lt;/em&gt; type account. Probably I was wrong as a &lt;em&gt;Premium&lt;/em&gt; account would suffice, but when I realised this my account was already changed into a Business account, and PayPal was asking for all kind of weird papers. For some reason, they were not very eager to change back my account type, thus I went on and asked all kind of recommendations from Karin Dom, and explained to PayPal that actually I am not affiliated to them, we are just collecting funds for them. Finally they allowed my account, and now I can collect the donations. The twist in this story is that Karin Dom struggles getting the Business status, thus despite the PayPal button on their site, you can donate to them only via direct&amp;nbsp;transfers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use the identifier if you can&lt;/strong&gt; Unfortunately &lt;em&gt;django-donation&lt;/em&gt; still has some flaws. The main problem is that I am not saving the unique identifiers of every transaction, and several of our donors were registered twice or even more times. I will fix this once I have some more time (might be tonight?), or feel free to do it, if you have some free time.&amp;nbsp;:)&lt;/p&gt;

&lt;p&gt;Finally, you can check out &lt;a href="http://viktornagy.com/karin-dom/"&gt;our Karin Dom sponsorship site here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/D4VNHiwudw4rkbDIuHh8XiIh_8Y/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/D4VNHiwudw4rkbDIuHh8XiIh_8Y/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/D4VNHiwudw4rkbDIuHh8XiIh_8Y/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/D4VNHiwudw4rkbDIuHh8XiIh_8Y/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/NagyViktor/blog?a=j4KEoUhi16E:_UjJtPd20ig:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/NagyViktor/blog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/NagyViktor/blog?a=j4KEoUhi16E:_UjJtPd20ig:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/NagyViktor/blog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/NagyViktor/blog?a=j4KEoUhi16E:_UjJtPd20ig:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/NagyViktor/blog?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/NagyViktor/blog?a=j4KEoUhi16E:_UjJtPd20ig:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/NagyViktor/blog?i=j4KEoUhi16E:_UjJtPd20ig:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/NagyViktor/blog?a=j4KEoUhi16E:_UjJtPd20ig:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/NagyViktor/blog?i=j4KEoUhi16E:_UjJtPd20ig:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/NagyViktor/blog/~4/j4KEoUhi16E" height="1" width="1"/&gt;</content><feedburner:origLink>http://viktornagy.com/blog/2009/07/18/getting-donations-paypal/</feedburner:origLink></entry><entry><id>http://viktornagy.com/blog/2009/06/02/export-csv-django/</id><title type="html">Export to CSV with Django</title><updated>2009-06-02T09:36:41Z</updated><published>2009-06-02T09:20:48Z</published><category term="django" /><link href="http://viktornagy.com/blog/2009/06/02/export-csv-django/" rel="self" /><link href="http://feedproxy.google.com/~r/NagyViktor/blog/~3/nsqt3p6JHCo/" rel="alternate" /><content type="html">&lt;p&gt;The past week as a sub-project of django-conference, I&amp;#8217;ve built a really simple and hopefully useful application to make &lt;a href="https://launchpad.net/django-export-csv"&gt;csv exporting extremely easy&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It uses python&amp;#8217;s csv library, and can be set up for example with the following code in your&amp;nbsp;urlconf:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;from export_csv.views import export_csv 

export_attendees = {
    'queryset': Attendee.objects.all(),
    'filter_by': 'conference__pk',
    'export_data': {'is_presenter': 'Presents',
        'user.get_full_name': 'Attendee',
        'conference': 'Conference',
        'user.get_profile.affiliation': 'Affiliation',
        },
    'require_permission': 'conference.delete_attendee',
}

urlpatterns = patterns('',
    url(r'^export/attendees/(?P&amp;lt;object_id&amp;gt;\d+)/$', export_csv, 
    export_attendees, name='export_attendees'),
)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This code was taken from an ongoing project to build a &lt;a href="https://launchpad.net/django-conference"&gt;conference administering application for django&lt;/a&gt; (and for the &lt;a href="http://www.mktudegy.hu/"&gt;Hungarian Economists Association&lt;/a&gt;). &lt;/p&gt;

&lt;p&gt;Basically, the above setting will take a queryset by default that can be further filtered to get the data to be exported, and the &lt;code&gt;export_data&lt;/code&gt; dictionary describes the columns to be exported. As the example shows, the columns can be either callable or simple properties, and will be evaluated from the instances of the exported queryset, like &lt;code&gt;attendee_instance.is_presenter()&lt;/code&gt;. While column headers are given as the values for &lt;code&gt;export_data&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The view code is really simple, the only tricky part was to construct the callable/non-callable object paths described in &lt;code&gt;export_data&lt;/code&gt;, this is done by the following&amp;nbsp;method&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;def get_attr(object, attrs=None):
    if attrs == None or attrs == []:
        return object
    current = attrs.pop(0)
    try:
        return get_attr(callable(getattr(object, current)) and 
                    getattr(object, current)() or 
                    getattr(object, current), attrs)
    except ObjectDoesNotExist:
        return not_available
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If you would like to add some extra functionality, like date based exporting, or just would like to play with the code, go and grab it from&amp;nbsp;launchpad:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://launchpad.net/django-export-csv"&gt;django-export-csv&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;and its first implementation in &lt;a href="https://launchpad.net/django-conference"&gt;django-conference&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/RYvqiaWsRk1b4gw61HjV3eYPP5U/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/RYvqiaWsRk1b4gw61HjV3eYPP5U/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/RYvqiaWsRk1b4gw61HjV3eYPP5U/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/RYvqiaWsRk1b4gw61HjV3eYPP5U/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/NagyViktor/blog?a=nsqt3p6JHCo:IdVKlPSOyyw:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/NagyViktor/blog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/NagyViktor/blog?a=nsqt3p6JHCo:IdVKlPSOyyw:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/NagyViktor/blog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/NagyViktor/blog?a=nsqt3p6JHCo:IdVKlPSOyyw:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/NagyViktor/blog?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/NagyViktor/blog?a=nsqt3p6JHCo:IdVKlPSOyyw:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/NagyViktor/blog?i=nsqt3p6JHCo:IdVKlPSOyyw:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/NagyViktor/blog?a=nsqt3p6JHCo:IdVKlPSOyyw:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/NagyViktor/blog?i=nsqt3p6JHCo:IdVKlPSOyyw:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/NagyViktor/blog/~4/nsqt3p6JHCo" height="1" width="1"/&gt;</content><feedburner:origLink>http://viktornagy.com/blog/2009/06/02/export-csv-django/</feedburner:origLink></entry><entry><id>http://viktornagy.com/blog/2009/05/24/what-test-django/</id><title type="html">What to test in django?</title><updated>2009-05-24T15:25:31Z</updated><published>2009-05-24T14:41:31Z</published><category term="django" /><link href="http://viktornagy.com/blog/2009/05/24/what-test-django/" rel="self" /><link href="http://feedproxy.google.com/~r/NagyViktor/blog/~3/Cl8xbPcybdU/" rel="alternate" /><content type="html">&lt;p&gt;I&amp;#8217;m continuously trying to get used to test driven development, as I agree with its many advantages cited around the web. Still, I often find it hard to come up with a necessary (and hopefully sufficient) list of tests. Moreover, as I often code for fun only, I don&amp;#8217;t pay much attention to the question. This has changed now as I got a paying project. Here are my first insights, I hope it will help other django enthusiasts as well.&amp;nbsp;:)&lt;/p&gt;

&lt;p&gt;The bottom line is &lt;strong&gt;test every method you write&lt;/strong&gt;, including output variables and inside logic. Moreover, write tests that pass as they mimick normal usage, and then start to think about tests that fail if someone tries abnormal usage (like setting a start date after an end&amp;nbsp;date).&lt;/p&gt;

&lt;!--more--&gt;

&lt;h1&gt;Testing&amp;nbsp;models&lt;/h1&gt;

&lt;p&gt;The model contains your business logic and data. Something no user should be able to avoid or misuse. As django itself is thoroughly tested there is not much reason to test whether a NullBooleanField accepts None as a value, and in general I see no reason in testing a model&amp;#8217;s&amp;nbsp;attributes.&lt;/p&gt;

&lt;p&gt;On the other hand every defined method should be tested! For example, if you have a model to represent Comments with &lt;code&gt;approved&lt;/code&gt; and &lt;code&gt;published&lt;/code&gt; attributes, in the &lt;code&gt;save&lt;/code&gt; method you&amp;#8217;ll likely avoid saving if &lt;code&gt;approved==True and published==False&lt;/code&gt;. This is a logic to be tested. You should similarly check your &lt;code&gt;get_absolute_url&lt;/code&gt; (and similar) methods whether they provide proper&amp;nbsp;output.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;class ComentModel(models.Model):
    author = models.ForeignKey(User)
    comment = models.CharField
    published = models.BooleanField
    approved = models.NullBooleanField

    def save(self, force_insert=False, force_update=False):
        if approved==True and published==False:
            return
        super(Submission, self).save(force_insert, force_update)
&lt;/code&gt;&lt;/pre&gt;

&lt;h1&gt;Testing&amp;nbsp;forms&lt;/h1&gt;

&lt;p&gt;My feeling is that many people misunderstand the use of forms. Basically forms are to interact with non-trusted users (and sometimes to extend the admin functionality as well, but that&amp;#8217;s a different&amp;nbsp;story). &lt;/p&gt;

&lt;p&gt;This being said, it might happen that you have the same functionality on the admin and on your main site, like adding a comment for something. The difference being that on the admin site the user can pretend to be any other user for example, or can immediately approve his comment. While on the main site the user can comment only under his own name, and every comment might need approval.
Despite this difference, both comments will be stored in the same&amp;nbsp;Model. &lt;/p&gt;

&lt;p&gt;Moreover, every &lt;em&gt;logic related to a bit complex data that will be stored in the database&lt;/em&gt; should be included in your form definition, instead of using your views. This for example allows you to easily reuse the same form processing in different views (e.g. APIs might need different views than simple &lt;span class="caps"&gt;HTML&lt;/span&gt;, but they will still process the same&amp;nbsp;data).&lt;/p&gt;

&lt;p&gt;As this is the point many posts miss, I&amp;#8217;ll repeat it: &lt;strong&gt;when you would like to save data coming form users in a model rather keep your views simple, and make your forms complex, than having complex views and simple forms&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;So, as we will have some hard-working form classes, what should we test?
The same principle applies as before: test every method you define! If there is any reason to define your own &lt;code&gt;__init__&lt;/code&gt; method, then you should test the modified form properties as&amp;nbsp;well. &lt;/p&gt;

&lt;p&gt;For example, take a &lt;a href="https://launchpad.net/django-conference"&gt;conference application&lt;/a&gt;. Every conference has many Topics, and if you want to present a paper you might need to select a Topic when you submit your idea. But the form should show only the topics for the conference you are interested in. This can be achieved by overwriting the &lt;code&gt;__init__&lt;/code&gt; method like&amp;nbsp;this&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;class SubmissionForm(RegistrationForm):
    topic = forms.ModelChoiceField(label=_('Select a topic'), 
           queryset=models.Topic.objects.all(), empty_label=None,
           help_text=_('Topics help our reviewers to coordinate their work. \
            Please find a topic that best matches your paper'))

    def __init__(self, *args, **kwargs):
        super(SubmissionForm, self).__init__(*args, **kwargs)
        self.fields['topic'].queryset=\
            models.Conference.objects.get(pk=kwargs['initial']['conference']).topic_set.all()
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In this case we should test that &lt;code&gt;form.fields['topic'].queryset&lt;/code&gt; contains all the topics of the given conference, and only&amp;nbsp;those.&lt;/p&gt;

&lt;h1&gt;Testing&amp;nbsp;views&lt;/h1&gt;

&lt;p&gt;As you already know, you should check every method you define. Moreover, you should check that the methods you want to be restricted (e.g. by the &lt;code&gt;@login_required&lt;/code&gt; decorator) are really restricted, but are available for authorised users. For more subtle restrictions, like showing only your own posts further testing is necessary, as this assumes that the user should be logged in, but still can&amp;#8217;t see every&amp;nbsp;post.&lt;/p&gt;

&lt;p&gt;Moreover, if you are using forms like above that &lt;em&gt;should be initialised&lt;/em&gt;, then you should check that they are indeed properly initialised. In the above case this would mean to check the template context variable for the form object, and see the value of &lt;code&gt;response.context['myform'].initial&lt;/code&gt;.&lt;/p&gt;

&lt;h1&gt;Testing&amp;nbsp;templates&lt;/h1&gt;

&lt;p&gt;As I am not a designer guy, I&amp;#8217;ve found this is the easy part! Basically, I just test for the variables that the designers might need to put together the content of the page. Like&amp;nbsp;this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;class TemplateTests(MyTestCase):

    def check_template_var(self, rsp, var):
        '''
        Check for template variable ``var`` in response rsp
        '''
        if isinstance(rsp.context, dict):
            contexts = [rsp.context,]
        else:
            contexts = rsp.context

        for c in contexts: 
            if c.has_key(var):
                return True
        return False        

    def test_conference_list_html(self):
        rsp = self.client.get(reverse('conference_list'))
        self.assertTrue(self.check_template_var(rsp, 'conference_list'),
                        "conference_list is not set for conference_list.html")
&lt;/code&gt;&lt;/pre&gt;

&lt;h1&gt;Other&amp;nbsp;tests&lt;/h1&gt;

&lt;p&gt;It might happen that you write some custom template tags, filter, or some strange admin functionality. I haven&amp;#8217;t thought much about testing these yet, but for &lt;a href="http://techblog.ironfroggy.com/2008/10/how-to-test-django-template-tags-part-1.html"&gt;template tags at least there are some posts on the&amp;nbsp;web&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;Conclusion&lt;/h1&gt;

&lt;p&gt;The bottom line is to &lt;strong&gt;test every method you write&lt;/strong&gt;, including output variables and inside&amp;nbsp;logic.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/_00azzomp3R6gDwj-iFHq6LqIG4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_00azzomp3R6gDwj-iFHq6LqIG4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/_00azzomp3R6gDwj-iFHq6LqIG4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_00azzomp3R6gDwj-iFHq6LqIG4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/NagyViktor/blog?a=Cl8xbPcybdU:_1Tyus16zWw:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/NagyViktor/blog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/NagyViktor/blog?a=Cl8xbPcybdU:_1Tyus16zWw:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/NagyViktor/blog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/NagyViktor/blog?a=Cl8xbPcybdU:_1Tyus16zWw:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/NagyViktor/blog?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/NagyViktor/blog?a=Cl8xbPcybdU:_1Tyus16zWw:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/NagyViktor/blog?i=Cl8xbPcybdU:_1Tyus16zWw:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/NagyViktor/blog?a=Cl8xbPcybdU:_1Tyus16zWw:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/NagyViktor/blog?i=Cl8xbPcybdU:_1Tyus16zWw:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/NagyViktor/blog/~4/Cl8xbPcybdU" height="1" width="1"/&gt;</content><feedburner:origLink>http://viktornagy.com/blog/2009/05/24/what-test-django/</feedburner:origLink></entry></feed>
