Hi Juhana,

thanks for the fast response! This is helpfull, I will study it :)

Best Greetings

bengoshi
On 7/28/19 4:13 PM, Juhana Jauhiainen wrote:
> Hi, 
>
> You can achieve this by customizing the widget which renders the HTML
> for the form field. You can find more information in the documentation
> here  
> https://docs.djangoproject.com/en/2.2/ref/forms/widgets/
>
> -Juhana
>
> On Sun, 28 Jul 2019 at 16.57, Kai Kobschätzki
> <kai.kobschaet...@gmail.com <mailto:kai.kobschaet...@gmail.com>> wrote:
>
>     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
>
>
>      
>
>     -- 
>     You received this message because you are subscribed to the Google
>     Groups "Django users" group.
>     To unsubscribe from this group and stop receiving emails from it,
>     send an email to django-users+unsubscr...@googlegroups.com
>     <mailto:django-users+unsubscr...@googlegroups.com>.
>     To view this discussion on the web visit
>     
> https://groups.google.com/d/msgid/django-users/6341d842-c40d-b84e-fe6f-d35c188b332b%40gmail.com
>     
> <https://groups.google.com/d/msgid/django-users/6341d842-c40d-b84e-fe6f-d35c188b332b%40gmail.com?utm_medium=email&utm_source=footer>.
>
> -- 
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscr...@googlegroups.com
> <mailto:django-users+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CABScFx8P0Ov9S%3D3nxeHOR36n-D%3Dh4cjCk0cijFjEfmwsxP9jQQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CABScFx8P0Ov9S%3D3nxeHOR36n-D%3Dh4cjCk0cijFjEfmwsxP9jQQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0db13a21-be1b-2297-fbc4-c9cbcd9a09ff%40gmail.com.

Reply via email to