From the category archives:

django

Django Tip: Outputting list of items separated by commas, but only if it has more than one item

April 24, 2008

How many times do you need to do this? You have a list of things to output. The list can be empty, has one element, or more. You want to separate each items with a separator for readability. What do you do?
1. The simple but not reader friendly way:
toppings = [ 'cheese','tomatos','pineapple' ]
or toppings = [...]

Read the full article →

Emacs for OS X Leopard

January 30, 2008

I have been using the text mode emacs up to now. On Windows (yikes!) I uses the xemacs with windows extension, which is pretty nice. Quick googling found me Carbon Emacs. It has been updated, universal binary and Leopard. Highly recommended !

Read the full article →

gettext on Leopard for Django Internationalization

January 30, 2008

I started working on one of my internationalized applications on the new Mac. I realized I did not install “gettext”, which is required by the make-messages and compile-messages scripts. I want to avoid installing things into OS X if I can. Then I found the easy way out:
1. Install poedit for os x. I need [...]

Read the full article →

Django on Leopard

January 20, 2008

Part of the reason I was waiting to switch from using Windows XP (gasp) as my Django development platform to OS X is that it is actually easier to install the platform on XP. Windows does not come with any of the tools, so it was a matter of installing the version that I need. [...]

Read the full article →

Django 0.96 Internationalization

January 6, 2008

I am trying out Django’s i18n support and found a few issues. This only applies if you are using newforms and Django 0.96.
Order of Middleware
First, the order of the middleware is important. It is defined in the documentation, but I missed it the first time around. You have to put the localeMiddleware after SessionMiddleware:
MIDDLEWARE_CLASSES = [...]

Read the full article →

Using pytextile in Django – problem with unicode

October 4, 2007

I am coverting a J2EE application over to django. The existing app uses Textile as a simple markup for user text input. After installing pytextile (which is under ownership change at the moment), I found a problem using it:
The “textile” filter works for strings and strings retrieved from my database, but when I try to [...]

Read the full article →

The Importance of the initial argument in Django newforms library

September 19, 2007

I like Django a lot. In fact I am in the middle of converting a large J2EE application to Django. Sometimes I run into a problem using it, and knowing Django, I know there is a good solution. To find the solution however, sometimes require very careful reading of the documentation.
Case in point. The solution [...]

Read the full article →

psycopg2 broken for 64 bit ubuntu

June 30, 2007

I want to test out amd64 bit ubuntu. Django keeps failing on syncdb. Turned out the python Postgresql library, psycopg2 is “severely broken” in the 64bit packaging. You will get a segment fault when trying to run the simplest thing like syncdb on an empty system if you are using postgresql. Oh well, for now, [...]

Read the full article →

Django dumpdata does not work with numeric fields

June 28, 2007

I try to dump my database in Postgres to json so that I can load it into my test system. Executing manage.py dumpdata gives me an error:
Unable to serialize database: Decimal(”349.00″) is not JSON serializable
Some googling finds ticket number 3324, a problem with the serializer. This is patched in the development tree already. Since I [...]

Read the full article →

Django + Ajax != dojo

May 22, 2007

If you good for “django” and “ajax”, you will quickly come across the “Django adopts Dojo as Ajax framework” article at Ajaxian. The important thing to note is that is it not (yet) true. Django 0.96, the current release, does not contain dojo. The dojo toolkit if definitely one of the better ones out [...]

Read the full article →