Skip to content
This repository
Browse code

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

"field.rel_model" -- fixes #120
  • Loading branch information...
commit f4aae7605e7d7dc043775aa0c77db261fddfd9b0 1 parent cdc3fbc
Charles Leifer authored October 16, 2012

Showing 1 changed file with 3 additions and 3 deletions. Show diff stats Hide diff stats

  1. 6  peewee.py
6  peewee.py
@@ -1738,7 +1738,7 @@ def create_foreign_key(self, model_class, field):
1738 1738
         db_table = model_class._meta.db_table
1739 1739
         constraint = 'fk_%s_%s_%s' % (
1740 1740
             db_table,
1741  
-            field.to._meta.db_table,
  1741
+            field.rel_model._meta.db_table,
1742 1742
             field.db_column,
1743 1743
         )
1744 1744
 
@@ -1746,8 +1746,8 @@ def create_foreign_key(self, model_class, field):
1746 1746
             'table': self.quote(db_table),
1747 1747
             'constraint': self.quote(constraint),
1748 1748
             'field': self.quote(field.db_column),
1749  
-            'to': self.quote(field.to._meta.db_table),
1750  
-            'to_field': self.quote(field.to._meta.primary_key.db_column),
  1749
+            'to': self.quote(field.rel_model._meta.db_table),
  1750
+            'to_field': self.quote(field.rel_model._meta.primary_key.db_column),
1751 1751
             'cascade': ' ON DELETE CASCADE' if field.cascade else '',
1752 1752
         }
1753 1753
 

0 notes on commit f4aae76

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