From b782ae2880aa63f18579f588a3b1481648b77a3c Mon Sep 17 00:00:00 2001 From: Horilla Date: Fri, 28 Feb 2025 11:13:39 +0530 Subject: [PATCH] [UPDT] PMS: Updated question template CRUD operations --- pms/forms.py | 9 +++++++++ .../question_template/question_template_form.html | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/pms/forms.py b/pms/forms.py index 79fd09d19..4a49d0b98 100644 --- a/pms/forms.py +++ b/pms/forms.py @@ -1183,3 +1183,12 @@ class EmployeeBonusPointForm(MF): if employee: self.fields["employee_id"].queryset = employee self.initial["employee_id"] = employee.first() + + def clean(self): + cleaned_data = super().clean() + bonus_point = cleaned_data.get("bonus_point") + if bonus_point <= 0: + raise forms.ValidationError( + {"bonus_point": _("Point should be greater than zero.")} + ) + return cleaned_data diff --git a/pms/templates/feedback/question_template/question_template_form.html b/pms/templates/feedback/question_template/question_template_form.html index 00368b0bb..70dde4ae5 100644 --- a/pms/templates/feedback/question_template/question_template_form.html +++ b/pms/templates/feedback/question_template/question_template_form.html @@ -14,4 +14,4 @@ hx-target="{% if form.instance.id %}#objectUpdateModalTarget{% else %}#objectCreateModalTarget{% endif %}"> {% csrf_token %} {{form.as_p}} - \ No newline at end of file +