I'm trying to build an html page in Django, where depending on the form passed the page will render different things. How can I know in the HTML the type of form passed?
I want to do something like this:
{% block content %}
<div class="content-section container" >
{% if form.type == 'ModelAForm' %}
<div class="content-section">
<form method="POST" enctype="multipart/form-data">
{% csrf_token %}
{{ form.driver_color }}
</form>
</div>
{% endif %}
{% if form.type == 'ModelBForm' %}
<div class="content-section">
<form method="POST" enctype="multipart/form-data">
{% csrf_token %}
{{ form.driver_name}}
</form>
</div>
{% endif %}
</div>
{% endblock content %}
On the {% if form.type == 'ModelAForm' %}
how can I know the form type?
question from:
https://stackoverflow.com/questions/65860247/django-html-check-form-type 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…