Giter Site home page Giter Site logo

django-compat's Introduction

django-compat

Build Status Stories in Ready

Forward and backwards compatibility layer for Django 1.4, 1.7, 1.8, and 1.9

Consider django-compat as an experiment based on the discussion on reddit. Let's see where it goes.

What started as an experiment based on this discussion on reddit has proven to be true in real life.

django-compat is under active development. To learn about other features, bug fixes, and changes, please refer to the changelog.

Who uses django-compat

Two popular examples of open source reusable app that uses django-compat are django-hijack and django-background-tasks.
Want to have yours listed here? Send us a PR.

Why use django-compat

  • Be able to use the LTS versions of Django and support newer versions in your app
  • Use features from newer Django versions in an old one
  • Manage and master the gap between different framework versions

How to use django-compat

Install compat from the PyPI or download and install manually. All relevant releases are listed here under releases.

Using one of the compatible objects is easy. For example

from compat import patterns, url

urlpatterns = patterns('ABC.views',
		url(r'^abc/$', 'abc', name='abc-link'),
...

See a full example here.

Compatible objects

Compatible object Specifically tested 1.4 1.7 1.8 1.9 Notes
BytesIO ✖️ ✔️ ✔️ ✔️ ✔️
EmailValidator ✖️ ✔️ ✔️ ✔️ ✔️
GenericForeignKey ✖️ ✔️ ✔️ ✔️
models.GenericForeignKey ✖️ ✔️ ✔️ ✔️ ✔️
HttpResponseBase ✖️ ✔️ ✔️ ✔️ ✔️
JsonResponse ✖️ ✔️ ✔️ ✔️ ✔️
SortedDict ✖️ ✔️ ✔️ ✔️ ✔️
StringIO ✖️ ✔️ ✔️ ✔️ ✔️
URLValidator ✖️ ✔️ ✔️ ✔️ ✔️
VariableNode ✖️ ✔️ ✔️ ✔️ ✔️
View ✖️ ✔️ ✔️ ✔️ ✔️
add_to_builtins ✖️ ✔️ ✔️ ✔️
atomic ✖️ ✔️ ✔️ ✔️ ✔️
clean_manytomany_helptext ✖️ ✔️ ✔️ ✔️ ✔️
commit ✔️ ✔️ ✔️ ✔️ ✔️
commit_on_success ✔️ ✔️ ✔️ ✔️ ✔️ commit_on_success replaced by atomic in Django >= 1.8
force_text ✖️ ✔️ ✔️ ✔️ ✔️
format_html ✔️ ✔️ ✔️ ✔️ ✔️
get_ident ✖️ ✔️ ✔️ ✔️ ✔️
get_model ✖️ ✔️ ✔️ ✔️ ✔️
get_model_name ✖️ ✔️ ✔️ ✔️ ✔️
get_user_model ✖️ ✔️ ✔️ ✔️ ✔️
get_username_field ✖️ ✔️ ✔️ ✔️ ✔️
handler404 ✖️ ✔️ ✔️ ✔️ ✔️
handler500 ✖️ ✔️ ✔️ ✔️ ✔️
import_module ✖️ ✔️ ✔️ ✔️ ✔️
import_string ✖️ ✔️ ✔️ ✔️ ✔️
include ✖️ ✔️ ✔️ ✔️ ✔️
parse_qs ✖️ ✔️ ✔️ ✔️ ✔️
patterns ✖️ ✔️ ✔️ ✔️ ✔️
python_2_unicode_compatible ✖️ ✔️ ✔️ ✔️ ✔️
resolve_url ✔️ ✔️ ✔️ ✔️ ✔️
rollback ✔️ ✔️ ✔️ ✔️ ✔️ Transaction savepoint (sid) is required for Django < 1.8
simplejson ✖️ ✔️ ✔️ ✔️ ✔️
slugify ✖️ ✔️ ✔️ ✔️ ✔️
smart_text ✖️ ✔️ ✔️ ✔️ ✔️
unquote_plus ✖️ ✔️ ✔️ ✔️ ✔️
url ✖️ ✔️ ✔️ ✔️ ✔️ Function used in urlpatterns
templatetags.compat.url ✔️ ✔️ ✔️ ✔️ ✔️ Templatetag; import with {% load url from compat %}
urlencode ✖️ ✔️ ✔️ ✔️ ✔️
urlparse ✖️ ✔️ ✔️ ✔️ ✔️
urlunparse ✖️ ✔️ ✔️ ✔️ ✔️
user_model_label ✖️ ✔️ ✔️ ✔️ ✔️

Resources and references

Resources

compat.py

Bits and bites of the following projects were re-used to build django-compat.

Changelog

### 2015/11/12

  • Added {% load url from compat %}

2015/11/11

  • 1.9 compatibility for existing objects with the following changes:
    • add_to_builtins was removed for Django >= 1.9
    • GenericForeignKey` was moved to compat.models`` for Django >= 1.9

2015/07/15

  • add_to_builtins was added

2015/07/08

  • get_query_set/get_queryset support was dropped again (see #29)

django-compat's People

Contributors

brad avatar eugena avatar geyser avatar jvamvas avatar lowks avatar moreati avatar philippeowagner avatar reduxionist avatar sebcorbin avatar thedrow avatar waffle-iron avatar walterrenner avatar yannik-ammann avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.