Add compatibility with Django versions prior to 1.5