compat for django 1.3x fixed

empty was introduced Django > 1.3
This commit is contained in:
Ludwig Kraatz 2012-12-04 13:40:07 +01:00
parent acaaa0384c
commit 5a9aa34415
2 changed files with 8 additions and 2 deletions

View File

@ -343,6 +343,13 @@ except ImportError:
kw = dict((k, int(v)) for k, v in kw.iteritems() if v is not None) kw = dict((k, int(v)) for k, v in kw.iteritems() if v is not None)
return datetime.datetime(**kw) return datetime.datetime(**kw)
# empty does not exist in 1.3x
if django.VERSION >= (1, 4):
from django.utils.functional import empty
else:
empty = object()
# Markdown is optional # Markdown is optional
try: try:
import markdown import markdown

View File

@ -5,9 +5,8 @@ from decimal import Decimal
from django.db import models from django.db import models
from django.forms import widgets from django.forms import widgets
from django.utils.datastructures import SortedDict from django.utils.datastructures import SortedDict
from django.utils.functional import empty
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from rest_framework.compat import get_concrete_model from rest_framework.compat import get_concrete_model, empty
# Note: We do the following so that users of the framework can use this style: # Note: We do the following so that users of the framework can use this style:
# #