Skip to content

arteria/django-compat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

django-compat

Build Status Stories in Ready Coverage Status PyPI

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

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.

django-compat is free software. If you find it useful and would like to give back, please consider to make a donation using Bitcoin or PayPal. Thank you!

Compatible objects

Compatible object Specifically tested 1.8 1.9 1.10 1.11 Notes
BytesIO βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
DjangoJSONEncoder βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
EmailValidator βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
GenericForeignKey βœ–οΈ βœ”οΈ ❌ ❌ ❌
models.GenericForeignKey βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
HttpResponseBase βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
JsonResponse βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
LocaleRegexProvider βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
LocaleRegexURLResolver βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
NoReverseMatch βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
RegexURLPattern βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
RegexURLResolver βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
Resolver404 βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
ResolverMatch βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
SortedDict βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
StringIO βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
URLValidator βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
VariableNode βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
View βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
add_to_builtins βœ–οΈ βœ”οΈ ❌ ❌ ❌
admin_utils βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
atomic βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
clean_manytomany_helptext βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
clear_url_caches βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
close_connection βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
commit βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
commit_on_success βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ `:heavy_check_mark: commit_on_success replaced by atomic in Django >= 1.8
force_text βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
format_html βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
get_callable βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
get_current_site βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
get_ident βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
get_mod_func βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
get_model βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
get_model_name βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
get_ns_resolver βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
get_resolver βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
get_script_prefix βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
get_template_loaders βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
get_urlconf βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
get_user_model βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
get_username_field βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
handler404 βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
handler500 βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
import_module βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
import_string βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
include βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
is_valid_path βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
parse_qs βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
patterns βœ–οΈ βœ”οΈ βœ”οΈ ❌ ❌
python_2_unicode_compatible βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
render_to_string βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ The new function signature (https://docs.djangoproject.com/en/1.9/releases/1.8/#dictionary-and-context-instance-arguments-of-rendering-functions) is backported to pre-1.8.
resolve βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
resolve_url βœ”οΈ βœ”οΈ βœ”οΈ ⚠️ ⚠️ 1.10: Reversing by dotted path has been removed
reverse βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
reverse_lazy βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
rollback βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ Transaction savepoint (sid) is required for Django < 1.8
set_script_prefix βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
set_urlconf βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
simplejson βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
slugify βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
smart_text βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
unquote_plus βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
url βœ–οΈ βœ”οΈ βœ”οΈ βœ–οΈ βœ–οΈ Function used in urlpatterns
tempat.url βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
`uravy_multiplication_x: βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
urlparse βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
urlresolvers βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
urlunparse βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
user_model_label βœ–οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
templatetags.compat.verbatim βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ Templatetag; import with {% load verbatim from compat %}. 1.4: Does not allow specific closing tags, e.g. {% endverbatim myblock %}, and does not preserve whitespace inside tags.

Resources and references

Resources

compat.py

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

Changelog

2017/04/07

  • Update existing patches for Django 1.10

2016/08/02

  • Update existing patches for Django 1.10

2016/06/01

  • Add get_current_site and admin_utils

2016/05/11

  • Fix error when installing package under python 3.4

###Β 2015/11/12

  • Backport new render_to_string function signature to Django < 1.8
  • Backport verbatim tag to Django 1.4
  • Add get_template_loaders
  • Add close_connection
  • Improve JsonResponse backport to Django 1.4
  • Add tests for import_module, get_model and add_to_builtins
  • Anticipate renaming of django.core.urlresolvers to django.urls in 1.10
  • Avoid warnings in setup.py

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)