diff --git a/django/contrib/admin/widgets.py b/django/contrib/admin/widgets.py index 491c78870f..3264355ed6 100644 --- a/django/contrib/admin/widgets.py +++ b/django/contrib/admin/widgets.py @@ -45,12 +45,15 @@ class FilteredSelectMultiple(forms.SelectMultiple): attrs['class'] = 'selectfilter' if self.is_stacked: attrs['class'] += 'stacked' - output = [super(FilteredSelectMultiple, self).render(name, value, attrs, choices)] - output.append('\n' - % (name, escapejs(self.verbose_name), int(self.is_stacked))) + output = [ + super(FilteredSelectMultiple, self).render(name, value, attrs, choices), + '\n' % ( + name, escapejs(self.verbose_name), int(self.is_stacked), + ), + ] return mark_safe(''.join(output)) diff --git a/django/core/management/commands/createcachetable.py b/django/core/management/commands/createcachetable.py index c1ec4539b6..fc47cea77d 100644 --- a/django/core/management/commands/createcachetable.py +++ b/django/core/management/commands/createcachetable.py @@ -61,8 +61,11 @@ class Command(BaseCommand): index_output = [] qn = connection.ops.quote_name for f in fields: - field_output = [qn(f.name), f.db_type(connection=connection)] - field_output.append("%sNULL" % ("NOT " if not f.null else "")) + field_output = [ + qn(f.name), + f.db_type(connection=connection), + '%sNULL' % ('NOT ' if not f.null else ''), + ] if f.primary_key: field_output.append("PRIMARY KEY") elif f.unique: diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py index ea9b3e78b4..9ebb94a6ce 100644 --- a/django/db/models/sql/compiler.py +++ b/django/db/models/sql/compiler.py @@ -1082,10 +1082,7 @@ class SQLUpdateCompiler(SQLCompiler): self.pre_sql_setup() if not self.query.values: return '', () - table = self.query.tables[0] qn = self.quote_name_unless_alias - result = ['UPDATE %s' % qn(table)] - result.append('SET') values, update_params = [], [] for field, model, val in self.query.values: if hasattr(val, 'resolve_expression'): @@ -1124,7 +1121,11 @@ class SQLUpdateCompiler(SQLCompiler): values.append('%s = NULL' % qn(name)) if not values: return '', () - result.append(', '.join(values)) + table = self.query.tables[0] + result = [ + 'UPDATE %s SET' % qn(table), + ', '.join(values), + ] where, params = self.compile(self.query.where) if where: result.append('WHERE %s' % where)