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/forms/models.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'django/forms') diff --git a/django/forms/models.py b/django/forms/models.py index 7effb202e3..5a40cdb5cb 100644 --- a/django/forms/models.py +++ b/django/forms/models.py @@ -1211,8 +1211,9 @@ class ModelChoiceField(ChoiceField): # This class is a subclass of ChoiceField for purity, but it doesn't # actually use any of ChoiceField's implementation. default_error_messages = { - 'invalid_choice': _('Select a valid choice. That choice is not one of' - ' the available choices.'), + 'invalid_choice': _( + 'Select a valid choice. That choice is not one of the available choices.' + ), } iterator = ModelChoiceIterator @@ -1331,8 +1332,9 @@ class ModelMultipleChoiceField(ModelChoiceField): hidden_widget = MultipleHiddenInput default_error_messages = { 'invalid_list': _('Enter a list of values.'), - 'invalid_choice': _('Select a valid choice. %(value)s is not one of the' - ' available choices.'), + 'invalid_choice': _( + 'Select a valid choice. %(value)s is not one of the available choices.' + ), 'invalid_pk_value': _('ā€œ%(pk)sā€ is not a valid value.') } -- cgit v1.3