Skip to content
Snippets Groups Projects
Commit d54a6484 authored by jan.bednarik's avatar jan.bednarik
Browse files

donate: Fix targeted donations form

parent 1effb0e5
No related branches found
No related tags found
2 merge requests!185Release,!184donate: Fix targeted donations form
Pipeline #2432 passed
......@@ -22,6 +22,15 @@ class DonateForm(forms.Form):
raise forms.ValidationError("Wrong periodicity!")
return value
def clean(self):
cleaned_data = super().clean()
if (
cleaned_data["portal_project_id"] == self.PORTAL_ID_IN_SELECT
and cleaned_data["select_portal_project_id"] is None
):
raise forms.ValidationError("Není zadán účel daru.")
return cleaned_data
def get_amount(self):
amount = self.cleaned_data["amount"]
if amount == self.CUSTOM_AMOUNT:
......
......@@ -92,7 +92,7 @@
});
$("#other_target_select").change(function () {
if ($(this).val() !== "-") {
if ($(this).val() !== "") {
$("#other_target").prop("checked", true);
updateLink($(this).val());
}
......
......@@ -37,7 +37,7 @@
<label class="custom-control-label col-form-label-lg custom-control-label-for-select" for="other_target">
Dar pro:
<select id="other_target_select" name="select_portal_project_id" class="custom-control-select">
<option value="-">--- vybrat ---</option>
<option value="">--- vybrat ---</option>
{% for target in other_targets %}
<option value="{{ target.portal_project_id }}">{{ target.title }}</option>
{% endfor %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment