Modify ↓
Ticket #678 (assigned enhancement)
If a field's default is set to an Enum, the resulting migration has a syntax error
| Reported by: | virtue@… | Owned by: | andrew |
|---|---|---|---|
| Priority: | minor | Milestone: | 1.0 |
| Component: | migrations | Version: | unknown |
| Keywords: | Cc: |
Description
I had code like this:
ENUM1 = Enum(...)
field1 = models.CharField?(max_length=100, default=ENUM1.SOME_VALUE)
The resulting migration had a typo, since it put the repr() of the value into the migration file:
default=EnumValue?(<enum.Enum object at 0x018C9F70>, 0, 'SOME_VALUE')
It's probably a bad idea to add an object as the default - this should probably have a str(ENUM1.SOME_VALUE) instead.
But the point of this ticket is better error reporting. It'd be nice if south would show an error when *creating* a migration. Right now it only shows a syntax error when running the migration.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

Good point, more robust errors before you run things would be nice.