Fix tests to handle correctly versions of python and django.

Signed-off-by: Victor Berger <victor.berger@m4x.org>