Heiho,
I wrote a class in views.py
class UploadFileForm(forms.Form): file = forms.FileField() and I use it in a function like def import_data(request): if request.method == "POST": form = UploadFileForm(request.POST, request.FILES) [...] return render( request, 'import_form.html', { 'form': form, [...] in my template import_form.html I embedded with {{ form }} It renders to <th><label for="id_file">File:</label></th><td><input type="file" name="file" required id="id_file"></td> All fine, all things do what they should do. But I want to insert in this rendering such thing like class="btn btn-info", so it would render <input type="file" class="btn btn-info" name="file" required id="id_file">. How is it possible? I wasn't able to find anything in the documentation. Thanks for your help, bengoshi
No comments:
Post a Comment