Jul-15-2020, 07:11 PM
Actually, since changing my form to the below, it now no longer works even though I have enctype="multipart/form-data"
Does anyone have any idea please?
{% extends 'music/base.html' %} {% block title %}Add a New Album{% endblock %} {% block body %} <form class="formContainer" method="post" enctype="multipart/form-data"> {% csrf_token %} {% for field in form %} {% if field.label != 'Album logo' %} <label for="field{{ forloop.counter }}">{{ field.label }}</label> <input type="text" id="field{{ forloop.counter }}" name="" value=""> {% else %} <label for="field{{ forloop.counter }}">{{ field.label }}</label> <input type="file" id="field{{ forloop.counter }}" name="" value="" accept="image/*"> {% endif %} <br> {% endfor %} <input type="submit" id="submitBtn" name="" value="Add"> </form> {% endblock %}Upon clicking the submit button in the form, it should take me to the details page for the Album that got created.
Does anyone have any idea please?