Fix unicode bug from python3 conversion
[pgweb/local.git] / templates / base / form.html
blob0576a78337d19e6e1ddbba3fc60a5fbffbafbe34
1 {%extends "base/page.html"%}
2 {%load pgfilters%}
3 {%block title%}{{operation|default:"Edit"}} {{formitemtype}}{%endblock%}
4 {%block contents%}
5 {%block pre_form_header%}{%endblock%}
6 <h1>{% if formtitle %}{{ formtitle|safe }}{% else %}{{operation|default:"Edit"}} {{formitemtype}}{% endif %}</h1>
7 {%if form_intro%}
8 <p>
9 {{form_intro|safe}}
10 </p>
11 {%endif%}
13 <form class="form-horizontal" method="post" action=".">{%if not nocsrf%}{% csrf_token %}{%endif%}
14 {%if form.errors %}
15 <div class="alert alert-danger">
16 Please correct the errors below, and re-submit the form.
17 </div>
18 {%endif%}
19 {% for field in form %}
20 {% if field.is_hidden %}
21 {{ field }}
22 {% else %}{# not field.is_hidden #}
23 {% if not field|ischeckbox %}
24 <div class="form-group">
25 {{field|label_class:"control-label col-lg-12"}}
26 <div class="col-lg-12 controls">
27 {% if field.errors %}
28 {% for e in field.errors %}
29 <div class="alert alert-danger">{{e}}</div>
30 {% endfor %}
31 {% endif %}
32 {{field|field_class:"form-control"}}
33 {%if field.help_text%}
34 <small>{{field.help_text|safe}}</small>
35 {%endif%}
36 </div>
37 </div>
38 {% else %}{# field|ischeckbox #}
39 <div class="form-group"{%if field|ismultiplecheckboxes%} data-cbtitles="{{described_checkboxes|dictlookup:field.name|json}}"{%endif%}>
40 <div class="col-lg-12 {%if field|isrequired_error%} alert alert-danger{%endif%}">
41 {% if not field|ismultiplecheckboxes %}
42 <div class="form-check">
43 {{ field }}
44 <label for="{{ field.id_for_label }}" class="form-check-label">
45 {{ field.label }}
46 </label>
47 {%if field.help_text%}
48 <small class="form-text text-muted">{{field.help_text|safe}}</small>
49 {%endif%}
50 </div>
51 {% else %}
52 {{ field.label_tag }} {{field.help_text|safe}}
53 {% for cb in field %}
54 <div class="form-check">
55 {{ cb.tag }}
56 <label for="{{ cb.id_for_label }}" class="form-check-label">{{ cb.choice_label }}</label>
57 </div>
58 {% endfor %}
59 {% endif %}
60 </div>
61 {% if field.errors and not field|isrequired_error %}
62 {% for e in field.errors %}
63 <div class="alert alert-danger">{{e}}</div>
64 {% endfor %}
65 {% endif %}
66 </div>
67 {% endif %}
68 {% endif %}
69 {%endfor%}
70 <button type="submit" class="btn btn-primary">{{savebutton|default:"Save"}}</button>
71 </form>
72 {%block post_form%}{%endblock%}
73 {%endblock%}
75 {% block extrahead %}
76 {{ block.super }}
77 <link rel="stylesheet" type="text/css" href="/media/css/showdown_preview.css" />
78 {%endblock%}
80 {%block extrascript%}
81 <script type="text/javascript" src="/media/showdown/showdown.js"></script>
82 <script type="text/javascript" src="/media/js/showdown_preview.js"></script>
83 <script type="text/javascript" src="/media/js/forms.js"></script>
84 {%if recaptcha%}
85 <script type="text/javascript" src="https://www.google.com/recaptcha/api.js?hl=en" async defer></script>
86 {%endif%}
87 {%endblock%}