diff --git a/opentech/apply/funds/models.py b/opentech/apply/funds/models.py index 347470855cfbe410e192d6ecc26aae50e3ccf352..1dbe4acfbbeb3a3cd8e85f0bcc97bd590378d0b9 100644 --- a/opentech/apply/funds/models.py +++ b/opentech/apply/funds/models.py @@ -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 diff --git a/opentech/apply/funds/templates/funds/fund_type.html b/opentech/apply/funds/templates/funds/fund_type.html index 76ac0ea2b0fcc515d6b24fa6aa7b7a2da055fe87..440b71dd6a7d5a0644f013c87a2945a063e7a395 100644 --- a/opentech/apply/funds/templates/funds/fund_type.html +++ b/opentech/apply/funds/templates/funds/fund_type.html @@ -1,26 +1,32 @@ {% 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 %}