Home

Awesome

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

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 objectSpecifically tested1.81.91.101.11Notes
BytesIO:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
DjangoJSONEncoder:heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
EmailValidator:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
GenericForeignKey:heavy_multiplication_x::heavy_check_mark::x::x::x:
models.GenericForeignKey:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
HttpResponseBase:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
JsonResponse:heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
LocaleRegexProvider:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
LocaleRegexURLResolver:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
NoReverseMatch:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
RegexURLPattern:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
RegexURLResolver:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
Resolver404:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
ResolverMatch:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
SortedDict:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
StringIO:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
URLValidator:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
VariableNode:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
View:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
add_to_builtins:heavy_multiplication_x::heavy_check_mark::x::x::x:
admin_utils:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
atomic:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
clean_manytomany_helptext:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
clear_url_caches:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
close_connection:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
commit:heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
commit_on_success:heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:`:heavy_check_mark:commit_on_success replaced by atomic in Django >= 1.8
force_text:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
format_html:heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
get_callable:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
get_current_site:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
get_ident:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
get_mod_func:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
get_model:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
get_model_name:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
get_ns_resolver:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
get_resolver:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
get_script_prefix:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
get_template_loaders:heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
get_urlconf:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
get_user_model:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
get_username_field:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
handler404:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
handler500:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
import_module:heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
import_string:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
include:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
is_valid_path:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
parse_qs:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
patterns:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::x::x:
python_2_unicode_compatible:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
render_to_string:heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark: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:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
resolve_url:heavy_check_mark::heavy_check_mark::heavy_check_mark::warning::warning:1.10: Reversing by dotted path has been removed
reverse:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
reverse_lazy:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
rollback:heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:Transaction savepoint (sid) is required for Django < 1.8
set_script_prefix:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
set_urlconf:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
simplejson:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
slugify:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
smart_text:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
unquote_plus:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
url:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_multiplication_x::heavy_multiplication_x:Function used in urlpatterns
tempat.url:heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
`uravy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
urlparse:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
urlresolvers:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
urlunparse:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
user_model_label:heavy_multiplication_x::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
templatetags.compat.verbatim:heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark: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

2016/08/02

2016/06/01

2016/05/11

### 2015/11/12

2015/11/11

2015/07/15

2015/07/08