From 7af66176aa88ad0ebd97ebd96000b3b3c68002d5 Mon Sep 17 00:00:00 2001 From: Paul Konstantin Gerke Date: Sat, 5 Mar 2022 13:09:08 +0100 Subject: [PATCH] Black --- .../0021_alter_settings_language.py | 27 ++++++++++++++++--- core/widgets.py | 6 ++--- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/babybuddy/migrations/0021_alter_settings_language.py b/babybuddy/migrations/0021_alter_settings_language.py index 3333ce13..e02543be 100644 --- a/babybuddy/migrations/0021_alter_settings_language.py +++ b/babybuddy/migrations/0021_alter_settings_language.py @@ -6,13 +6,32 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('babybuddy', '0020_update_language_en_to_en_us'), + ("babybuddy", "0020_update_language_en_to_en_us"), ] operations = [ migrations.AlterField( - model_name='settings', - name='language', - field=models.CharField(choices=[('zh-hans', 'Chinese (simplified)'), ('nl', 'Dutch'), ('en-US', 'English (US)'), ('en-GB', 'English (UK)'), ('fr', 'French'), ('fi', 'Finnish'), ('de', 'German'), ('it', 'Italian'), ('pl', 'Polish'), ('pt', 'Portuguese'), ('es', 'Spanish'), ('sv', 'Swedish'), ('tr', 'Turkish')], default='en-US', max_length=255, verbose_name='Language'), + model_name="settings", + name="language", + field=models.CharField( + choices=[ + ("zh-hans", "Chinese (simplified)"), + ("nl", "Dutch"), + ("en-US", "English (US)"), + ("en-GB", "English (UK)"), + ("fr", "French"), + ("fi", "Finnish"), + ("de", "German"), + ("it", "Italian"), + ("pl", "Polish"), + ("pt", "Portuguese"), + ("es", "Spanish"), + ("sv", "Swedish"), + ("tr", "Turkish"), + ], + default="en-US", + max_length=255, + verbose_name="Language", + ), ), ] diff --git a/core/widgets.py b/core/widgets.py index b77251d3..1c21865e 100644 --- a/core/widgets.py +++ b/core/widgets.py @@ -42,7 +42,7 @@ class TagsEditor(Widget): def build_attrs(self, base_attrs, extra_attrs=None): """ - Bootstrap integration adds form-control to the classes of the widget. + Bootstrap integration adds form-control to the classes of the widget. This works only for "plain" input-based widgets however. In addition, we need to add a custom class "babybuddy-tags-editor" for the javascript file to detect the widget and take control of its contents. @@ -56,9 +56,9 @@ class TagsEditor(Widget): def get_context(self, name: str, value: Any, attrs) -> Dict[str, Any]: """ Adds extra information to the payload provided to the widget's template. - + Specifically: - - Query a list if "recently used" tags (max 256 to not cause + - Query a list if "recently used" tags (max 256 to not cause DoS issues) from the database to be used for auto-completion. ("most") - Query a smaller list of 5 tags to be made available from a quick selection widget ("quick").