From d55a1e5809b424907528af42bfdfc2991ef11651 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Thu, 3 Feb 2022 11:20:46 +0100 Subject: [4.0.x] Refs #33476 -- Refactored problematic code before reformatting by Black. In these cases Black produces unexpected results, e.g. def make_random_password( self, length=10, allowed_chars='abcdefghjkmnpqrstuvwxyz' 'ABCDEFGHJKLMNPQRSTUVWXYZ' '23456789', ): or cursor.execute(""" SELECT ... """, [table name], ) Backport of c5cd8783825b5f6384417dac5f3889b4210b7d08 from main. --- django/db/models/sql/query.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'django/db/models/sql') diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index 6436b25bae..3c18fcb4c7 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -1706,8 +1706,7 @@ class Query(BaseExpression): for alias in self._gen_col_aliases([annotation]): if isinstance(self.alias_map[alias], Join): raise FieldError( - 'Joined field references are not permitted in ' - 'this query' + 'Joined field references are not permitted in this query' ) if summarize: # Summarize currently means we are doing an aggregate() query @@ -1734,8 +1733,9 @@ class Query(BaseExpression): if not allow_joins and len(join_list) > 1: raise FieldError('Joined field references are not permitted in this query') if len(targets) > 1: - raise FieldError("Referencing multicolumn fields with F() objects " - "isn't supported") + raise FieldError( + "Referencing multicolumn fields with F() objects isn't supported" + ) # Verify that the last lookup in name is a field or a transform: # transform_function() raises FieldError if not. transform = join_info.transform_function(targets[0], final_alias) -- cgit v1.3