Patches for compatibility with newer Django versions