Skip to content

Commit

Permalink
Add counties to the association form
Browse files Browse the repository at this point in the history
  • Loading branch information
tudoramariei committed Jan 4, 2024
1 parent 759a239 commit a09e902
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 27 deletions.
3 changes: 3 additions & 0 deletions backend/donations/views/my_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def get(self, request, *args, **kwargs):
"limit": settings.DONATIONS_LIMIT,
"ngo": user_ngo,
"donors": grouped_donors,
"counties": settings.FORM_COUNTIES,
}
return render(request, self.template_name, context)

Expand All @@ -63,6 +64,7 @@ def get(self, request, *args, **kwargs):
context = {
"user": request.user,
"ngo": request.user.ngo if request.user.ngo else None,
"counties": settings.FORM_COUNTIES,
}

return render(request, self.template_name, context)
Expand Down Expand Up @@ -107,6 +109,7 @@ def post(self, request, *args, **kwargs):
context = {
"user": request.user,
"ngo": request.user.ngo if request.user.ngo else None,
"counties": settings.FORM_COUNTIES,
}

return render(request, self.template_name, context)
3 changes: 0 additions & 3 deletions backend/templates/v1/components/county.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@



<select class="form-control" id="county" name="county" required x-moz-errormessage="Județul este obligatoriu" title="Județul este obligatoriu">
<option value="" class="select-placeholder">Județul</option>
<optgroup label="București">
Expand Down
26 changes: 2 additions & 24 deletions backend/templates/v1/components/ngo-details-form.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,35 +43,13 @@
<input class="form-control" type="text" name="ong-adresa" placeholder="Adresa Asociației" value="{{ ngo.address if ngo }}" required maxlength="100" />
</div>
<div class="col-xs-4">
<select class="form-control" id="ong-judet" name="ong-judet" required x-moz-errormessage="Județul este obligatoriu" title="Județul este obligatoriu">
<option value="">Județul</option>
<option value="RO" {{ "selected" if county == ngo.county }}>Toată țara</option>
<optgroup label="București">
{% for number in range(1, 7) %}
<option value="{{ number }}" {{ "selected" if number|string == ngo.county }}>Sector {{ number }}</option>
{% endfor %}
</optgroup>
{% for county in counties %}
<option value="{{ county }}" {{ "selected" if county == ngo.county }} >{{ county }}</option>
{% endfor %}
</select>
{% include "components/county.html" %}
</div>
</div>
<div class="form-group">
<div class="col-xs-12">
<label for="ong-activitate">În ce regiune iși desfășoară ONG-ul activitatea?</label>
<select class="form-control" id="ong-activitate" name="ong-activitate" required x-moz-errormessage="Zona de activitate este obligatorie" title="Zona de activitate este obligatorie">
<option value="">Zona de activitate</option>
<option value="RO" {{ "selected" if county == ngo.active_region }}>National</option>
<optgroup label="București">
{% for number in range(1, 7) %}
<option value="{{ number }}" {{ "selected" if number|string == ngo.active_region }}>Sector {{ number }}</option>
{% endfor %}
</optgroup>
{% for county in counties %}
<option value="{{ county }}" {{ "selected" if county == ngo.active_region }} >{{ county }}</option>
{% endfor %}
</select>
{% include "components/county.html" %}
</div>
</div>
<div class="form-group choose-url-group">
Expand Down

0 comments on commit a09e902

Please sign in to comment.