form_page.html 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. {% extends "base.html" %}
  2. {% load wagtailcore_tags navigation_tags wagtailimages_tags %}
  3. {% block content %}
  4. <div class="container">
  5. <div class="row">
  6. <div class="col-md-12">
  7. <h1 class="index-header__title">{{ page.title }}</h1>
  8. </div>
  9. <div class="col-md-8 index-header__body-introduction">
  10. {% if page.intro %}
  11. <p class="intro">{{ page.intro|richtext }}</p>
  12. {% endif %}
  13. {% if page.body %}
  14. {{ page.body }}
  15. {% endif %}
  16. </div>
  17. </div>
  18. </div>
  19. <div class="container">
  20. <div class="row">
  21. <div class="col-md-8 form-page">
  22. {% comment %}
  23. You could render your form using a Django rendering shortcut such as `{{ form.as_p }}` but that will tend towards unsemantic code, and make it difficult to style. You can read more on Django form at:
  24. https://docs.djangoproject.com/en/3.2/topics/forms/#form-rendering-options
  25. {% endcomment %}
  26. <form action="{% pageurl page %}" method="POST">
  27. {% csrf_token %}
  28. {% if form.subject.errors %}
  29. <ol>
  30. {% for error in form.subject.errors %}
  31. <li><strong>{{ error|escape }}</strong></li>
  32. {% endfor %}
  33. </ol>
  34. {% endif %}
  35. {% for field in form %}
  36. <div class="form-page__field" aria-required={% if field.field.required %}"true"{% else %}"false"{% endif %}>
  37. {{ field.label_tag }}{% if field.field.required %}<span class="required">*</span>{% endif %}
  38. {% if field.help_text %}
  39. <p class="help">{{ field.help_text }}</p>
  40. {% endif %}
  41. {{ field }}
  42. </div>
  43. {% endfor %}
  44. <input type="submit">
  45. </form>
  46. </div>
  47. </div>
  48. </div>
  49. {% endblock content %}