Skip to content

Instantly share code, notes, and snippets.

@armicron
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save armicron/cf47df570014da6ce6f3 to your computer and use it in GitHub Desktop.
Save armicron/cf47df570014da6ce6f3 to your computer and use it in GitHub Desktop.
upgrading django
1) (Backward compatible) Django 1.8 get_current_site RequestSite support
https://github.com/pennersr/django-allauth/commit/1a25ea96efcb969945df53be220bb65d75ef50db
2) simplejson compatibility
try:
from django.utils import simplejson
except ImportError:
import json as simplejson
3) try:
from django.contrib.sites.requests import RequestSite
except ImportError:
# Django < 1.7
from django.contrib.sites.models import RequestSite
4) try:
from django.apps import apps
get_model = apps.get_model
except ImportError:
# Django < 1.7
from django.db.models import loading
get_model = loading.get_model
https://github.com/macropin/django-registration/blob/9e27a77f4a47c98cdd404207a983b3831d0781db/registration/compat.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment