Skip to content

Commit

Permalink
Merge pull request #680 from awesto/releases/0.11.x
Browse files Browse the repository at this point in the history
fix 677: Error on enum type during manage.py migrations
  • Loading branch information
jrief committed Nov 2, 2017
2 parents 6578c1f + df8848b commit c7aabe4
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions shop/models/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ def from_db_value(self, value, expression, connection, context):
def get_prep_value(self, state):
if isinstance(state, self.enum_type):
return state.value
if isinstance(state, int):
return state
raise ValueError("Value must be of type {}".format(self.enum_type))
return state

def to_python(self, state):
return self.enum_type(state)
Expand Down

0 comments on commit c7aabe4

Please sign in to comment.