Skip to content

Commit

Permalink
Merge pull request #679 from awesto/releases/0.11.x
Browse files Browse the repository at this point in the history
Fix #678: manage.py dumpdata raises an exception
  • Loading branch information
jrief committed Nov 2, 2017
2 parents 51cb522 + acceb1a commit 6578c1f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions shop/models/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def to_python(self, state):
return self.enum_type(state)

def value_to_string(self, obj):
if not isinstance(obj, self.enum_type):
value = getattr(obj, self.name)
if not isinstance(value, self.enum_type):
raise ValueError("Value must be of type {}".format(self.enum_type))
return obj.name
return value.name

0 comments on commit 6578c1f

Please sign in to comment.