Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove support for assigning None to a SplitField #614

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading