Modify ↓
Ticket #435 (assigned defect)
Changing a ForeignKey from a "real" model to a proxy of it generates invalid migration code
| Reported by: | Ulrich Petri <mail@…> | Owned by: | andrew |
|---|---|---|---|
| Priority: | major | Milestone: | 1.0 |
| Component: | migrations | Version: | 0.7 |
| Keywords: | invalid code | Cc: |
Description
Steps to reproduce:
1) Have a model with a ForiegnKey? to e.g. auth.User
2) create & run migration
3) Add a ProxyModel? of auth.User (in my example "FilerUser?")
4) try to create migration (nothing to be done)
5) Change ForiegnKey? on first Model to use the Proxy
6) create migration - invalid python code results (see below)
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'FilerUser'
db.create_table('auth_user', (
,
))
db.send_create_signal('filer', ['FilerUser'])
def backwards(self, orm):
# Deleting model 'FilerUser'
db.delete_table('auth_user')
Even worse than the broken forwards migration is the backwards one which would delete the base of the proxy model.
Attachments
Change History
comment:2 Changed 3 years ago by Ulrich Petri <mail@…>
I have to correct my report: actually I have a ManyToMany? field not a ForeignKey?.
Note: See
TracTickets for help on using
tickets.

This is probably related to #423, but doing a different operation.