Re: Given a model, how can I get a widget for each field?

2018-03-21 Thread Bernd Wechner
Actually I stand corrected, no need to build a format all. *django.forms.fields_for_model* provides just the fields for model and their widgets. Awesome. Neat and tidy. On Wednesday, 21 March 2018 13:08:31 UTC+11, Bernd Wechner wrote: > > Andréas and Andreas, > > I admit I smiled to see Andréas

Re: Given a model, how can I get a widget for each field?

2018-03-20 Thread Bernd Wechner
Andréas and Andreas, I admit I smiled to see Andréas seconding Andreas' post ;-). One my best friends in primary school was an Andreas ;-). Given I have no form and don't want one, ModelForm in its declarative for seems undesirable. But your thinking is good and I realise in response and in re

Re: Given a model, how can I get a widget for each field?

2018-03-20 Thread Andréas Kühne
Hi, Like Andreas is saying the only way to define the default widgets is to use a form - and the simplest way to define a form is to use a ModelForm. When you use Django you should do best by trying to work WITH the framework instead of working against it. Forms are used for connecting templates

Re: Given a model, how can I get a widget for each field?

2018-03-20 Thread Cictani
Without a form you can't get the Widget which is used by default. Are the fields always the same? If yes you could create a ModelForm on the fly and render the fields manually. Best regards, Andreas -- You received this message because you are subscribed to the Google Groups "Django users"

Given a model, how can I get a widget for each field?

2018-03-20 Thread Bernd Wechner
Pulling my hair out again. I don't have a form, nor want a form, stunning really, but I just have the model. And I want the field widgets. I can't seem to find them anywhere. I know you can specify widget= on form fields when declaring the model, but can't find it anywhere in the data struct