added compatibility to django >= 1.6