Fix bug when django version < 1.5