mirror of https://github.com/django/django.git
Fixed #5989 -- Fixed a problem with values being incorrectly reused by
reference in field subclassing. Thanks, flupke. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6748 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
0cae3d55b6
commit
260f9c5112
|
@ -28,10 +28,10 @@ class Creator(object):
|
|||
def __get__(self, obj, type=None):
|
||||
if obj is None:
|
||||
raise AttributeError('Can only be accessed via an instance.')
|
||||
return self.value
|
||||
return obj.__dict__[self.field.name]
|
||||
|
||||
def __set__(self, obj, value):
|
||||
self.value = self.field.to_python(value)
|
||||
obj.__dict__[self.field.name] = self.field.to_python(value)
|
||||
|
||||
def make_contrib(func=None):
|
||||
"""
|
||||
|
|
|
@ -103,4 +103,14 @@ TypeError: Invalid lookup type: 'lt'
|
|||
>>> obj = list(serializers.deserialize("json", stream))[0]
|
||||
>>> obj.object == m
|
||||
True
|
||||
|
||||
# Test retrieving custom field data
|
||||
>>> m.delete()
|
||||
>>> m1 = MyModel(name="1", data=Small(1, 2))
|
||||
>>> m1.save()
|
||||
>>> m2 = MyModel(name="2", data=Small(2, 3))
|
||||
>>> m2.save()
|
||||
>>> for m in MyModel.objects.all(): print unicode(m.data)
|
||||
12
|
||||
23
|
||||
"""}
|
||||
|
|
Loading…
Reference in New Issue