Skip to content
This repository has been archived by the owner on Jan 29, 2023. It is now read-only.

Commit

Permalink
Move deconstruct to EnumInternalMixin
Browse files Browse the repository at this point in the history
  • Loading branch information
slavov-v committed Jun 20, 2019
1 parent 7839761 commit b03696b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 0 additions & 8 deletions django_enum_choices/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
8 changes: 8 additions & 0 deletions django_enum_choices/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit b03696b

Please sign in to comment.