Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Moving the 'normalization' of field_names into a lower-level method

  • Loading branch information...
commit 06e8cb92afd2dfdef69a080541df2a65e138894d 1 parent 023d481
@coleifer authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 peewee.py
View
5 peewee.py
@@ -412,6 +412,9 @@ def create_table(self, model_class, safe=False, extra=''):
def create_index_query(self, model_class, field_names, unique, framing=None):
framing = framing or 'CREATE %(unique)s INDEX %(index)s ON %(table)s(%(field)s);'
+ if isinstance(field_names, basestring):
+ field_names = (field_names,)
+
columns = []
for field_name in field_names:
if field_name not in model_class._meta.fields:
@@ -435,8 +438,6 @@ def create_index_query(self, model_class, field_names, unique, framing=None):
}
def create_index(self, model_class, field_names, unique=False):
- if isinstance(field_names, basestring):
- field_names = (field_names,)
self.execute(self.create_index_query(model_class, field_names, unique))
def create_foreign_key(self, model_class, field):
Please sign in to comment.
Something went wrong with that request. Please try again.