Toont een gebonden veld op de site, maar niet vereist (HTML, django, Python)
https://drive.google.com/file/d/1Gt8oqnrRFgV1kXxn6YN4iHt16V_ym9_Y/view?usp=sharing
Hallo. Krijgt het volgende wanneer de pagina wordt weergegeven.
code formulierweergave
Hallo. Krijgt het volgende wanneer de pagina wordt weergegeven.
code formulierweergave
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<form method="post" action="." enctype="multipart/form-data" class="text-gray-300 placeholder:text-black">
{%csrf_token%}
<div class="space-y-4">
{{form.as_p}}
{{formset.management_form}}
{% for form in formset %}
{% if form.instance.image %}
<p>{{ form.instance.image.name }}</p>
{% endif %}
{{ form.non_field_errors }}
{{ form.hidden_fields }}
{% for field in form.visible_fields %}
{% if field.name != 'image' %}
{{ field.errors }}
{{ field.label_tag }} {{ field.field.widget }}
{% endif %}
{% endfor %}
{% endfor %}
<label for="id_images">Images:</label>
<input type="file" id="id_images" name="images" multiple>
</div>
{% if form.errors or form.non_field_errors or formset.non_form_errors %}
<div class="mb-3 p-6 bg-red-100 rounded-xl">
{% for field in form %}
{{ field.errors }}
{% endfor %}
{% for form in formset %}
{{ form.errors }}
{% for field in form %}
{{ field.errors }}
{% endfor %}
{% endfor %}
{{form.non_field_errors}}
{{formset.non_form_errors}}
</div>
{%endif%}
<button class="mt-2 py-2 px-8 text-lg rounded-full font-bold" style="color: #2C4341; background-color: #B3F963; font-family: anonymous pro;">Submit</button>
</form>
{%csrf_token%}
<div class="space-y-4">
{{form.as_p}}
{{formset.management_form}}
{% for form in formset %}
{% if form.instance.image %}
<p>{{ form.instance.image.name }}</p>
{% endif %}
{{ form.non_field_errors }}
{{ form.hidden_fields }}
{% for field in form.visible_fields %}
{% if field.name != 'image' %}
{{ field.errors }}
{{ field.label_tag }} {{ field.field.widget }}
{% endif %}
{% endfor %}
{% endfor %}
<label for="id_images">Images:</label>
<input type="file" id="id_images" name="images" multiple>
</div>
{% if form.errors or form.non_field_errors or formset.non_form_errors %}
<div class="mb-3 p-6 bg-red-100 rounded-xl">
{% for field in form %}
{{ field.errors }}
{% endfor %}
{% for form in formset %}
{{ form.errors }}
{% for field in form %}
{{ field.errors }}
{% endfor %}
{% endfor %}
{{form.non_field_errors}}
{{formset.non_form_errors}}
</div>
{%endif%}
<button class="mt-2 py-2 px-8 text-lg rounded-full font-bold" style="color: #2C4341; background-color: #B3F963; font-family: anonymous pro;">Submit</button>
</form>
Verder is dit een template. Als je dit letterlijk ziet moet je kijken of de template-parser wel correct wordt aangeroepen. Maar wat meer uitleg kan geen kwaad.
Gewijzigd op 12/09/2024 12:24:55 door - Ariën -