TLDR; Introducing django-compat - arteria's solution for for- and backwards compatibility from Django 1.4.x to 1.8.x./1.9.x
SITUATION
We really love how Django evolves and how the core gets better and better. New major versions of the framework that comes with changes, bugfixes and new features are released quickly. This is great and nothing is wrong with that!
But there are issues from the business/agency/our point of view:
* We are not as fast as Django is
* We have reusable apps that must work with multiple Django versions and
* We have a lot of these apps, open and closed source
A lot of (3rd party/open source) apps
* ignore older Django version due to the additional effort or
* have this try/except pattern everywhere in the code or
* encapsulate them in a per app compat.py file, see a some example in the projects README
All our "reusable apps" for client project and products where built on and for the Django LTS 1.4 version. With the release of the new LTS version we started every new project on 1.8, but still have all other older projects that runs on 1.4 and depends on these apps and it's update that must be compatible with both versions in our case.
SOLUTION
To handle this problem we created django-compat [1], which is something similar to six. The goals of django-compat are:
* Eliminate code duplication from app to app and handle them in one central place.
* Make apps working with multiple Django version and provide a backward compatibility
* Bringing things that are availbale in newer releases (sth. like importing from future) into older one
* Have a stable and testet single library that handles these compatible objects ...
CURRENT STATE / WHATS NEXT
We are using this library/approach successful in production on our clients project, in our products and its in open source apps. Eg django-hijack, django-background-tasks, ... to provide best possible stability It's tested using the test cases that are shipped with Django itself.
So it provides for- and backward compatibility between Django versions (we basically cover what is supported by Django itself and (will, WIP) align to the official releases.
We already started to integrate 1.9 support. Next will be to add more of 1.9 and more tests.
We are aware that there are some issues with the approach in some cases. Eg the get query set renaming. [2]
I'm curious what you think about django-compat and if it would also simplify your other djangonauts' life.
Regards,
Philippe
PS I: I'm introducing this on the developer mailing list due to a chat on the DjangoCon Europe with Loic Bistuer.
PS II: This thing was discoussed already on reddit. [3]