Ticket #45 (closed defect: fixed)
Invalid code generated by startmigration --initial
| Reported by: | eallik@… | Owned by: | andrew |
|---|---|---|---|
| Priority: | major | Milestone: | 0.5 |
| Component: | commands | Version: | 0.4 |
| Keywords: | Cc: |
Description
I get totally invalid Python code when using startmigration --initial
Attachments
Change History
comment:1 Changed 5 years ago by amccurdy
The problem is the code inspector can't figure out the definition for your Reservation model's end_datetime field. There's a big note in the migration file indicating this on line number 134.
For a quick fix, you can either copy the field definition of end_datetime to the migration.
The real reason this is broken is the way startmigration determines the field definition. If you moved your "make_reservation" function below the field definitions in the Reservation model, everything should work.
Obviously that's not an acceptable answer. It's not an easy problem to solve. We're working on trying to do that, but I wanted to provide you with as workaround until that happens.
comment:2 Changed 4 years ago by andrew
- Status changed from new to accepted
- Version changed from subversion to 0.4
- Milestone set to The Future

models.py