Adding try statement to newer django versions compatibility