Forward and backwards compatibility layer for Django 1.4, 1.7, 1.8, 1.9, 1.10, and 1.11
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.
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.
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 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 |
✔️ | ✔️ | ✔️ | ✔️ | `✔️ | 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. |
Bits and bites of the following projects were re-used to build django-compat.
get_current_site
and admin_utils
### 2015/11/12
add_to_builtins
was removed for Django >= 1.9GenericForeignKey` was moved to
compat.models`` for Django >= 1.9add_to_builtins
was addedget_query_set
/get_queryset
support was dropped again (see #29)