Created
June 14, 2014 05:35
-
-
Save theskumar/ff8de60ff6a33bdacaa8 to your computer and use it in GitHub Desktop.
Django Compatibility
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import django | |
from django.conf import settings | |
from django.utils import six | |
# Django 1.5 add support for custom auth user model | |
if django.VERSION >= (1, 5): | |
AUTH_USER_MODEL = settings.AUTH_USER_MODEL | |
else: | |
AUTH_USER_MODEL = "auth.User" | |
try: | |
from django.contrib.auth import get_user_model | |
except ImportError: | |
from django.contrib.auth.models import User | |
get_user_model = lambda: User | |
# get_indent | |
if six.PY3: | |
from threading import get_ident | |
else: | |
from thread import get_ident # noqa |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi
We created an app called django-compat to handle exactly these challenges. Eventually you can use it at some time in your projects.