diff --git a/django_enum_choices/fields.py b/django_enum_choices/fields.py index 02cf1e9..a694fd0 100644 --- a/django_enum_choices/fields.py +++ b/django_enum_choices/fields.py @@ -18,14 +18,6 @@ class EnumCharField(EnumInternalFieldMixin, CharField): def __init__(self, enum_class, *args, **kwargs): super().__init__(enum_class, *args, **kwargs) - def deconstruct(self): - name, path, args, kwargs = super().deconstruct() - - if self.enum_class: - kwargs['enum_class'] = self.enum_class - - return name, path, args, kwargs - class EnumChoiceField: def __new__(cls, enum_class: Enum, **kwargs): diff --git a/django_enum_choices/mixins.py b/django_enum_choices/mixins.py index 008b77f..a3c0641 100644 --- a/django_enum_choices/mixins.py +++ b/django_enum_choices/mixins.py @@ -35,3 +35,11 @@ def to_python(self, value): return value return self.to_enum_value(value) + + def deconstruct(self): + name, path, args, kwargs = super().deconstruct() + + if self.enum_class: + kwargs['enum_class'] = self.enum_class + + return name, path, args, kwargs