I am displaying a form that involves uploading an image in my Django template.
This is the template:
{% extends 'header.html' %}
{% block content %}
<br>
<div class="w-50 card mx-auto">
<div class="card-body text-center">
<h2 class="card-title">New Post</h2>
<form method="post">
{% csrf_token %}
<p><strong>
Title<br>
{{ form.Title }}
</strong></p>
<p><strong>
Description<br>
{{ form.Description }}
</strong></p>
<p><strong>
Image
{{ form.Image }}
</strong></p>
<p><strong>
Election<br>
{{ election_form.PostElection }}
</strong></p>
<button type="submit" class='button btn btn-outline-dark'>Post</button>
</form>
</div>
</div>
{% endblock %}
As you can see, the submit button on the form has some Bootstrap attached. This makes it look different to the Choose File button on the image upload form. How do I apply the Bootstrap applied to the submit button to the button in the form?
After crawling the interwebs, I found the link below but first here's the skinny:
Implementing bootstrap4 style on a choose file button while using a modelForm
The main point is to use a span with a bootstrap class in HTML. Then nest your form.field inside while passing in 'style' attributes (CSS)'display: none;'
https://www.abeautifulsite.net/whipping-file-inputs-into-shape-with-bootstrap-3