Skip to content

Commit

Permalink
Merge pull request #614 from ProtixIT/splitfield-notnone
Browse files Browse the repository at this point in the history
Remove support for assigning `None` to a `SplitField`
  • Loading branch information
foarsitter committed Jun 13, 2024
2 parents 324ea2b + c2d6cb5 commit 4275f84
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 7 deletions.
3 changes: 0 additions & 3 deletions model_utils/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,6 @@ def __init__(self, field):
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):
Expand Down
4 changes: 0 additions & 4 deletions tests/test_fields/test_split_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ def test_access_via_class(self):
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
Expand Down

0 comments on commit 4275f84

Please sign in to comment.