mirror of
https://github.com/Hopiu/django-model-utils.git
synced 2026-04-10 14:50:58 +00:00
Remove support for assigning None to a SplitField
This behavior wasn't documented and didn't fully work: it breaks as soon as you try to save a model with a `None` value.
This commit is contained in:
parent
a86c14e4e7
commit
c2d6cb5021
2 changed files with 0 additions and 7 deletions
|
|
@ -208,9 +208,6 @@ class SplitDescriptor:
|
|||
def __get__(self, instance, owner):
|
||||
if instance is None:
|
||||
raise AttributeError('Can only be accessed via an instance.')
|
||||
content = instance.__dict__[self.field.name]
|
||||
if content is None:
|
||||
return None
|
||||
return SplitText(instance, self.field.name, self.excerpt_field_name)
|
||||
|
||||
def __set__(self, obj, value):
|
||||
|
|
|
|||
|
|
@ -53,10 +53,6 @@ class SplitFieldTests(TestCase):
|
|||
with self.assertRaises(AttributeError):
|
||||
Article.body
|
||||
|
||||
def test_none(self):
|
||||
a = Article(title='Some Title', body=None)
|
||||
self.assertEqual(a.body, None)
|
||||
|
||||
def test_assign_splittext(self):
|
||||
a = Article(title='Some Title')
|
||||
a.body = self.post.body
|
||||
|
|
|
|||
Loading…
Reference in a new issue