Ugly code to fix support in django 1.3