fix support for django < 1.6 and python 2.6