Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixing bad references to self.quote in mysql

  • Loading branch information...
commit ee39365fe0bb18ddfeb73eb787b7c70c6bc77f87 1 parent f4aae76
@coleifer authored
Showing with 6 additions and 5 deletions.
  1. +6 −5 peewee.py
View
11 peewee.py
@@ -1731,6 +1731,7 @@ def _connect(self, database, **kwargs):
return mysql.connect(db=database, **conn_kwargs)
def create_foreign_key(self, model_class, field):
+ compiler = self.get_compiler()
framing = """
ALTER TABLE %(table)s ADD CONSTRAINT %(constraint)s
FOREIGN KEY (%(field)s) REFERENCES %(to)s(%(to_field)s)%(cascade)s;
@@ -1743,11 +1744,11 @@ def create_foreign_key(self, model_class, field):
)
query = framing % {
- 'table': self.quote(db_table),
- 'constraint': self.quote(constraint),
- 'field': self.quote(field.db_column),
- 'to': self.quote(field.rel_model._meta.db_table),
- 'to_field': self.quote(field.rel_model._meta.primary_key.db_column),
+ 'table': compiler.quote(db_table),
+ 'constraint': compiler.quote(constraint),
+ 'field': compiler.quote(field.db_column),
+ 'to': compiler.quote(field.rel_model._meta.db_table),
+ 'to_field': compiler.quote(field.rel_model._meta.primary_key.db_column),
'cascade': ' ON DELETE CASCADE' if field.cascade else '',
}
Please sign in to comment.
Something went wrong with that request. Please try again.