Add compatibility with newer Django versions