backward compatibility with django version older than 1.6