Support for Python 3 and Django 1.5

I used the 2to3 script, then fix the few remaining problems.

Sorry for the huge diff of 2 files, I don't know why the merge wasn't better. If you have suggestion, feel free to tell me.