[Python-modules-commits] [django-recurrence] 01/03: Fixes for Django 1.10
Thomas Goirand
zigo at moszumanska.debian.org
Fri Aug 5 10:55:22 UTC 2016
This is an automated email from the git hooks/post-receive script.
zigo pushed a commit to branch master
in repository django-recurrence.
commit f185a5e8c0a3ad7cfaf5f956d1aafc1c94aa8de1
Author: Thomas Goirand <zigo at debian.org>
Date: Fri Aug 5 10:50:55 2016 +0000
Fixes for Django 1.10
django.db.models.fields.subclassing has gone away entirely
(the release notes mention that SubfieldBase has gone, but
don't mention the removal of Creator - I'm guessing it was
viewed as an internal API).
---
recurrence/compat.py | 21 +++++++++++++++++++++
recurrence/fields.py | 3 +--
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/recurrence/compat.py b/recurrence/compat.py
new file mode 100644
index 0000000..450537b
--- /dev/null
+++ b/recurrence/compat.py
@@ -0,0 +1,21 @@
+try:
+ from django.db.models.fields.subclassing import Creator
+except ImportError:
+ # This class was removed in Django 1.10, so I've pulled it into
+ # django-recurrence.
+
+ class Creator(object):
+ """
+ A placeholder class that provides a way to set the attribute
+ on the model.
+ """
+ def __init__(self, field):
+ self.field = field
+
+ def __get__(self, obj, type=None):
+ if obj is None:
+ return self
+ return obj.__dict__[self.field.name]
+
+ def __set__(self, obj, value):
+ obj.__dict__[self.field.name] = self.field.to_python(value)
diff --git a/recurrence/fields.py b/recurrence/fields.py
index 783d52b..d4652cb 100644
--- a/recurrence/fields.py
+++ b/recurrence/fields.py
@@ -1,9 +1,8 @@
from django.db.models import fields
from django.utils.six import string_types
-from django.db.models.fields.subclassing import Creator
-
import recurrence
from recurrence import forms
+from recurrence.compat import Creator
try:
from south.modelsinspector import add_introspection_rules
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/django-recurrence.git
More information about the Python-modules-commits
mailing list