@@ -312,7 +312,7 @@ def as_sql(self):
312312 result .append ("VALUES (%s)" % ", " .join (placeholders [0 ]))
313313 return [(" " .join (result ), tuple (params ))]
314314
315- sql , params = [
315+ items = [
316316 (" " .join (result + ["VALUES (%s)" % ", " .join (p )]), vals )
317317 for p , vals in zip (placeholders , params )
318318 ]
@@ -323,16 +323,19 @@ def as_sql(self):
323323 if meta .has_auto_field :
324324 # db_column is None if not explicitly specified by model field
325325 auto_field_column = meta .auto_field .db_column or meta .auto_field .column
326-
327- if auto_field_column in columns :
328- quoted_table = self .connection .ops .quote_name (meta .db_table )
329- # If there are no fields specified in the insert..
330- if not has_fields :
331- sql = "INSERT INTO %s DEFAULT VALUES" % quoted_table
332- else :
333- sql = "SET IDENTITY_INSERT %s ON;\n %s;\n SET IDENTITY_INSERT %s OFF" % \
334- (quoted_table , sql , quoted_table )
335- return sql , params
326+ out = []
327+ for sql , params in items :
328+ if auto_field_column in columns :
329+ quoted_table = self .connection .ops .quote_name (meta .db_table )
330+ # If there are no fields specified in the insert..
331+ if not has_fields :
332+ sql = "INSERT INTO %s DEFAULT VALUES" % quoted_table
333+ else :
334+ sql = "SET IDENTITY_INSERT %s ON;\n %s;\n SET IDENTITY_INSERT %s OFF" % \
335+ (quoted_table , sql , quoted_table )
336+ out .append ([sql , params ])
337+ items = out
338+ return items
336339
337340
338341class SQLDeleteCompiler (compiler .SQLDeleteCompiler , SQLCompiler ):
0 commit comments