Skip to content

Commit

Permalink
Merge pull request #3759 from unicef/develop
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
robertavram authored Sep 11, 2024
2 parents bab66ec + 588137b commit 7e94308
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ def get_blueprint_for_activity_and_method(activity: 'MonitoringActivity', method
help_text=question.specific_details,
required=False,
# For HACT questions, a warning that is mandatory to fill in is needed in the frontend
styling=['mandatory_warning'] if question.question.category.name == 'HACT' else []
styling=['mandatory_warning']
if 'olc' in question.question.other and
question.question.other["olc"].get("mandatory_warning", False) else []
)
)
level_block.add(target_block)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-03-26 09:09+0000\n"
"POT-Creation-Date: 2024-09-09 20:08+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -136,6 +136,9 @@ msgstr "مخصص"
msgid "Is Active"
msgstr "فعال"

msgid "Other details"
msgstr ""

msgid "Question"
msgstr "السؤال"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-03-26 09:09+0000\n"
"POT-Creation-Date: 2024-09-09 20:08+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -135,6 +135,9 @@ msgstr "Es personalizada"
msgid "Is Active"
msgstr "Está Activo"

msgid "Other details"
msgstr ""

msgid "Question"
msgstr "Pregunta"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-03-24 08:39+0000\n"
"POT-Creation-Date: 2024-09-09 20:08+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -135,6 +135,9 @@ msgstr "Est personnalisé"
msgid "Is Active"
msgstr "Est actif"

msgid "Other details"
msgstr ""

msgid "Question"
msgstr "Question"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-03-24 08:39+0000\n"
"POT-Creation-Date: 2024-09-09 20:08+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -135,6 +135,9 @@ msgstr "É Personalizado"
msgid "Is Active"
msgstr "Está activo"

msgid "Other details"
msgstr ""

msgid "Question"
msgstr "Pergunta"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-03-24 08:39+0000\n"
"POT-Creation-Date: 2024-09-09 20:08+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -137,6 +137,9 @@ msgstr "Пользовательский"
msgid "Is Active"
msgstr "Активен"

msgid "Other details"
msgstr ""

msgid "Question"
msgstr "Вопрос"

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.3 on 2024-09-09 15:37

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('field_monitoring_settings', '0003_initial'),
]

operations = [
migrations.AddField(
model_name='question',
name='other',
field=models.JSONField(blank=True, default=dict, verbose_name='Other details'),
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ class Question(models.Model):
is_custom = models.BooleanField(default=False, verbose_name=_('Is Custom'))
is_active = models.BooleanField(default=True, verbose_name=_('Is Active'))

other = models.JSONField(verbose_name=_('Other details'), blank=True, default=dict)

order = models.PositiveIntegerField(db_index=True, default=1)

objects = models.Manager.from_queryset(QuestionsQuerySet)()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,17 @@ class Meta:


class QuestionLightSerializer(serializers.ModelSerializer):
show_mandatory_warning = serializers.SerializerMethodField()

def get_show_mandatory_warning(self, obj):
return obj.other['olc'].get("mandatory_warning", False) if obj.other.get("olc") else False

class Meta:
model = Question
fields = (
'id', 'answer_type', 'choices_size', 'level',
'methods', 'category', 'sections', 'text',
'is_hact', 'is_active', 'is_custom', 'order'
'is_hact', 'is_active', 'is_custom', 'order', 'show_mandatory_warning'
)


Expand Down

0 comments on commit 7e94308

Please sign in to comment.