diff --git a/src/bot/admin.py b/src/bot/admin.py index 63ec548f..6f1097e5 100644 --- a/src/bot/admin.py +++ b/src/bot/admin.py @@ -41,7 +41,7 @@ def get_question(self, obj): """Display questions in admin panel.""" return obj.question[:100] - @admin.display(description="Короткое описание") + @admin.display(description="Текст на кнопке") def get_short_description(self, obj): """Display short_descriptions in admin panel.""" return obj.short_description[:100] @@ -49,7 +49,7 @@ def get_short_description(self, obj): @admin.display(description="Тип вопроса") def get_question_type(self, obj): """Display question_type in admin panel.""" - return obj.question_type[:100] + return obj.get_question_type_display()[:100] @admin.display(description="Ответ") def get_answer(self, obj): @@ -95,7 +95,7 @@ def get_title(self, obj): """Display title in admin panel.""" return obj.title[:100] - @admin.display(description="Короткое описание") + @admin.display(description="Текст на кнопке") def get_short_description(self, obj): """Display short_description in admin panel.""" return obj.short_description[:100] diff --git a/src/bot/migrations/0006_alter_fundprogram_short_description_and_more.py b/src/bot/migrations/0006_alter_fundprogram_short_description_and_more.py new file mode 100644 index 00000000..b1518f22 --- /dev/null +++ b/src/bot/migrations/0006_alter_fundprogram_short_description_and_more.py @@ -0,0 +1,36 @@ +# Generated by Django 4.2.4 on 2023-09-01 10:51 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("bot", "0005_alter_coordinator_email_address_and_more"), + ] + + operations = [ + migrations.AlterField( + model_name="fundprogram", + name="short_description", + field=models.CharField( + help_text="Введите название кнопки в боте для данной программы", + max_length=20, + verbose_name="Текст на кнопке", + ), + ), + migrations.AlterField( + model_name="question", + name="question_type", + field=models.CharField( + choices=[ + ("LEGAL_ASSISTANCE", "Юридическая помощь"), + ("SOCIAL_ASSISTANCE", "Социальная помощь"), + ("PSYCHOLOGICAL_ASSISTANCE", "Психологическая помощь"), + ], + default="LEGAL_ASSISTANCE", + help_text="Выберите тип помощи для вопроса", + max_length=100, + verbose_name="Тип вопроса", + ), + ), + ] diff --git a/src/bot/models.py b/src/bot/models.py index 3210f8da..3d24a5cf 100644 --- a/src/bot/models.py +++ b/src/bot/models.py @@ -100,7 +100,6 @@ class HelpTypes(models.TextChoices): PSYCHOLOGICAL_ASSISTANCE = "PSYCHOLOGICAL_ASSISTANCE", _( "Психологическая помощь" ) - COMMON_QUESTION = "COMMON_QUESTION", _("Общий вопрос") class Question(BaseModel): @@ -161,7 +160,7 @@ class FundProgram(BaseModel): ) short_description = models.CharField( max_length=20, - verbose_name="Короткое описание", + verbose_name="Текст на кнопке", help_text="Введите название кнопки в боте для данной программы", ) regions = models.ManyToManyField( diff --git a/src/bot_settings/admin.py b/src/bot_settings/admin.py index 83b20cb8..2809e632 100644 --- a/src/bot_settings/admin.py +++ b/src/bot_settings/admin.py @@ -7,7 +7,7 @@ class BotSettingsAdmin(admin.ModelAdmin): """Base admin configuration for BotSettings model.""" - list_display = ("get_title", "type", "get_value") + list_display = ("get_title", "get_type", "get_value") list_filter = ("type",) search_fields = ("title", "type", "value") readonly_fields = ("type",) @@ -22,6 +22,11 @@ def get_title(self, obj): """Display title of settings in admin panel.""" return obj.title[:100] + @admin.display(description="Тип значения") + def get_type(self, obj): + """Display type of settings in admin panel.""" + return obj.get_type_display()[:100] + @admin.display(description="Значение настройки") def get_value(self, obj): """Display value of settings in admin panel."""