Skip to content

Commit

Permalink
update and refactor of new_sponsorship_application_form to be usable …
Browse files Browse the repository at this point in the history
…for editing
  • Loading branch information
jessiebelle committed Jan 7, 2024
1 parent 4c32364 commit bfa4e1a
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 5 deletions.
27 changes: 23 additions & 4 deletions templates/sponsors/new_sponsorship_application_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@
{% load boxes widget_tweaks %}
{% load humanize %}
{% load sponsors %}
{% block page_title %}Sponsorship Information{% endblock %}


{% block page_title %}Submit Sponsorship Information{% endblock %}

{% block content %}
<article id="new_sponsorship_application_container" class="text">
<h1>Submit Sponsorship Information</h1>

<div id="sponsorship-info-container" class="user-feedback level-general">
{% if sponsor %}
<div>
<h1> Edit {{sponsor}}</h1>
</div>
{% else %}
<div id="sponsorship-info-container" class="user-feedback level-general">
{% if sponsorship_package %}
<p>
You selected the <b>{{ sponsorship_package.name }}</b> package {% if sponsorship_price %}costing ${{ sponsorship_price|intcomma }} USD {% endif %}and the following benefits:
Expand All @@ -34,6 +38,10 @@ <h1>Submit Sponsorship Information</h1>
<span class="remove"><label id="close-info-container">Close</label> | <a href="{% url 'select_sponsorship_application_benefits' %}">Back to select benefits</a></span>
</div>

<h1>Submit Sponsorship Information</h1>
{% endif %}


{% if form.errors %}
<span class="error-message">The form has one or more errors</span>
{{ form.non_field_errors }}
Expand Down Expand Up @@ -129,6 +137,9 @@ <h2>Basics</h2>
<p class="form_field">
<label>{{ form.web_logo.label }} <span class="error-message">{% if form.web_logo.errors %}{{ form.web_logo.errors.as_text }}</span>{% endif %}</label>
{% render_field form.web_logo %}
{% if sponsor.web_logo %}
<p>Currently: <a href="{{ sponsor.web_logo.url }}">{{ sponsor.web_logo.name }}</a></p>
{% endif %}
{% if form.web_logo.help_text %}
<br/>
<span class="helptext">{{ form.web_logo.help_text }}</span>
Expand All @@ -140,6 +151,9 @@ <h2>Basics</h2>
<p class="form_field">
<label>{{ form.print_logo.label }} <span class="error-message">{% if form.print_logo.errors %}{{ form.print_logo.errors.as_text }}</span>{% endif %}</label>
{% render_field form.print_logo %}
{% if sponsor.print_logo %}
<p>Currently: <a href="{{ sponsor.print_logo.url }}">{{ sponsor.print_logo.name }}</a></p>
{% endif %}
{% if form.print_logo.help_text %}
<br/>
<span class="helptext">{{ form.print_logo.help_text }}</span>
Expand Down Expand Up @@ -253,11 +267,16 @@ <h1>Contacts</h1>

<button class="formset-btn add-form-row" type="button">Extra contact</button>
</div>

{% if sponsor %}
<div class="form-actions">
<input type="submit" name="submit-btn" value="Save"/>
</div>
{% else %}
</div>

<input id="submit-btn" type="submit" value="Apply">
</form>
{% endif %}
</article>

{% endblock content %}
Expand Down
25 changes: 25 additions & 0 deletions templates/users/sponsor_info_update.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
{% block user_content %}
<div id="edit-sponsor-information">
<h1>Edit {{ sponsor }}</h1>
<h2>Basics</h2>

{% if form.errors %}
<span class="error-message">The form has one or more errors</span>
Expand All @@ -36,7 +37,31 @@ <h2>Sponsor Information</h2>
{% endif %}
{% render_field form.name %}
</p>
<div class="inline_fields">
<div>
<p class="form_field">
<label>{{ form.country_of_incorporation.label }} <span class="error-message">{% if form.country_of_incorporation.errors %}
{{ form.country.errors.as_text }}</span>{% endif %}</label>
{% render_field form.country_of_incorporation %}
{% if form.country_of_incorporation.help_text %}
<br/>
<span class="helptext">{{ form.country_of_incorporation.help_text }}</span>
{% endif %}
</p>
</div>

<div>
<p class="form_field">
<label>{{ form.state_of_incorporation.label }} <span class="error-message">{% if form.state_of_incorporation.errors %}
{{ form.state_of_incorporation.errors.as_text }}</span>{% endif %}</label>
{% render_field form.state %}
{% if form.state_of_incorporation.help_text %}
<br/>
<span class="helptext">{{ form.state_of_incorporation.help_text }}</span>
{% endif %}
</p>
</div>
</div>
<p class="form_field">
<label>{{ form.description.label }} <span class="error-message">{% if form.description.errors %}
{{ form.description.errors.as_text }}</span>{% endif %}</label>
Expand Down
2 changes: 1 addition & 1 deletion users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def get_context_data(self, *args, **kwargs):
@method_decorator(login_required(login_url=settings.LOGIN_URL), name="dispatch")
class UpdateSponsorInfoView(UpdateView):
object_name = "sponsor"
template_name = 'users/sponsor_info_update.html'
template_name = 'sponsors/new_sponsorship_application_form.html'
form_class = SponsorUpdateForm

def get_queryset(self):
Expand Down

0 comments on commit bfa4e1a

Please sign in to comment.