Skip to content

Commit

Permalink
Remove excerpt field workaround for South FakeORM
Browse files Browse the repository at this point in the history
South FakeORM hasn't been supported since fda2d39, but the workaround
introduced in 9147bec evaded deletion. The `NoRendered` model was
removed in 9df3df9, but with that model gone, the `no_excerpt_field`
argument became obsolete as well.
  • Loading branch information
mthuurne committed Apr 9, 2024
1 parent 4c9d6ee commit 10ec03a
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions model_utils/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,16 +222,8 @@ def __set__(self, obj, value):


class SplitField(models.TextField):
def __init__(self, *args, no_excerpt_field=False, **kwargs):
# for South FakeORM compatibility: the frozen version of a
# SplitField can't try to add an _excerpt field, because the
# _excerpt field itself is frozen as well. See introspection
# rules below.
self.add_excerpt_field = not no_excerpt_field
super().__init__(*args, **kwargs)

def contribute_to_class(self, cls, name, *args, **kwargs):
if self.add_excerpt_field and not cls._meta.abstract:
if not cls._meta.abstract:
excerpt_field = models.TextField(editable=False)
cls.add_to_class(_excerpt_field_name(name), excerpt_field)
super().contribute_to_class(cls, name, *args, **kwargs)
Expand All @@ -253,11 +245,6 @@ def get_prep_value(self, value):
except AttributeError:
return value

def deconstruct(self):
name, path, args, kwargs = super().deconstruct()
kwargs['no_excerpt_field'] = True
return name, path, args, kwargs


class UUIDField(models.UUIDField):
"""
Expand Down

0 comments on commit 10ec03a

Please sign in to comment.