Skip to content
Browse files

Fixing references in MySQLDatabase to "field.to" that was changed to

"field.rel_model" -- fixes #120
  • Loading branch information...
1 parent cdc3fbc commit f4aae7605e7d7dc043775aa0c77db261fddfd9b0 @coleifer committed
Showing with 3 additions and 3 deletions.
  1. +3 −3 peewee.py
View
6 peewee.py
@@ -1738,7 +1738,7 @@ def create_foreign_key(self, model_class, field):
db_table = model_class._meta.db_table
constraint = 'fk_%s_%s_%s' % (
db_table,
- field.to._meta.db_table,
+ field.rel_model._meta.db_table,
field.db_column,
)
@@ -1746,8 +1746,8 @@ def create_foreign_key(self, model_class, field):
'table': self.quote(db_table),
'constraint': self.quote(constraint),
'field': self.quote(field.db_column),
- 'to': self.quote(field.to._meta.db_table),
- 'to_field': self.quote(field.to._meta.primary_key.db_column),
+ 'to': self.quote(field.rel_model._meta.db_table),
+ 'to_field': self.quote(field.rel_model._meta.primary_key.db_column),
'cascade': ' ON DELETE CASCADE' if field.cascade else '',
}

0 comments on commit f4aae76

Please sign in to comment.
Something went wrong with that request. Please try again.