Re: forms.Form with class in html-rendering

2019-07-28 Thread Jani Tiainen
Hi. Be aware that pushing rendering data like styles to form code has a nasty drawback. If you want to change that it is code change. And at some point it will get burden to maintain styles in code. There are few options still. Recent versions of django renders widgets using templates. Use

Re: forms.Form with class in html-rendering

2019-07-28 Thread Kai Kobschätzki
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

Re: forms.Form with class in html-rendering

2019-07-28 Thread Juhana Jauhiainen
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 wrote: > Heiho, > > I wrote a

forms.Form with class in html-rendering

2019-07-28 Thread Kai Kobschätzki
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