Skip to content
Snippets Groups Projects
Commit 30e121b1 authored by Todd Dembrey's avatar Todd Dembrey
Browse files

Provide a way for the fund to display an error message if closed

parent 3af40b9e
No related branches found
No related tags found
No related merge requests found
......@@ -92,11 +92,11 @@ class FundType(AbstractStreamForm):
]
def serve(self, request):
if hasattr(request, 'is_preview'):
if hasattr(request, 'is_preview') or not self.open_round:
return super().serve(request)
# delegate to the open_round to use the latest form instances
request.show_page = True
request.show_round = True
return self.open_round.serve(request)
......@@ -195,7 +195,7 @@ class Round(AbstractStreamForm):
raise ValidationError(error)
def serve(self, request):
if hasattr(request, 'is_preview') or hasattr(request, 'show_page'):
if hasattr(request, 'is_preview') or hasattr(request, 'show_round'):
return super().serve(request)
# We hide the round as only the open round is used which is displayed through the
......
{% extends "base.html" %}
{% load wagtailcore_tags static %}
{% load wagtailcore_tags static i18n %}
{% block content %}
<h1>{% block title %}{{ page.title }}{% endblock %}</h1>
<form action="" method="POST">
{{ form.media }}
{% csrf_token %}
{% if not page.open_round and not page.start_date %}
{# the fund has no open rounds and we arent on a round page #}
<h3>{% trans "Sorry this fund is not accepting applications at the moment" %}</h3>
{% else%}
<form action="" method="POST">
{% csrf_token %}
{{ form.media }}
{% if form.errors or form.non_field_errors %}
<div class="messages">
There were some errors with your form. Please amend the fields highlighted below. {% if form.non_field_errors %}
<ul>
{% for error in form.non_field_errors %}
<li class="error">{{ error }}</li>
{% endfor %}
</ul>
{% endif %}
</div>
{% endif %}
{% if form.errors or form.non_field_errors %}
<div class="messages">
There were some errors with your form. Please amend the fields highlighted below. {% if form.non_field_errors %}
<ul>
{% for error in form.non_field_errors %}
<li class="error">{{ error }}</li>
{% endfor %}
</ul>
{% endif %}
</div>
{% endif %}
{{ form.as_p }}
<input type="submit">
</form>
{{ form.as_p }}
<input type="submit">
</form>
{% endif %}
{% endblock %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment