Re: Populating a form from the database

2009-08-04 Thread Thomas Guettler
Hi, if you use ModelForm, the data from the database are the initial form data. If you create a new record with ModelForm, you could use the "initial" parameter to supply some default values. More can be found in the docs. Thomas Magnus Valle schrieb: > Short: > How do I populate a form with

Re: Populating a form

2007-09-13 Thread Peter Melvyn
On 9/13/07, MikeHowarth <[EMAIL PROTECTED]> wrote: > Look at form_for_instance in newforms: I am not sure if it could help me. I try to demostrate my problem on the view fragment handling post request: form = MyHTMLForm(request.POST) if not form.is_valid(): # will render bound form else: tr

Re: Populating a form

2007-09-13 Thread MikeHowarth
Look at form_for_instance in newforms: http://www.djangoproject.com/documentation/newforms/ On Sep 13, 9:08 am, "Peter Melvyn" <[EMAIL PROTECTED]> wrote: > On 9/11/07, Ole Laursen <[EMAIL PROTECTED]> wrote: > > > You can also use the initial parameter when instantiating the form: > > And how t

Re: Populating a form

2007-09-13 Thread Peter Melvyn
On 9/11/07, Ole Laursen <[EMAIL PROTECTED]> wrote: > You can also use the initial parameter when instantiating the form: And how to solve situation when you've processed posted data and in the next step you need to redisplay the same form with some values reset to initial values? Peter --~--~

Re: Populating a form

2007-09-11 Thread Kenneth Gonsalves
On 12-Sep-07, at 10:41 AM, Ahik wrote: > newforms. you have to create a dictionary of the data you want in the form relating fieldname to the data and bind the form to this - see the bound form docs -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-

Re: Populating a form

2007-09-11 Thread Ahik
newforms. On Sep 12, 4:05 am, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > On 11-Sep-07, at 11:45 AM, AniNair wrote: > > >I am trying to learn python and django. Can someone please tell me > > how to populate some fields in a form > > newforms or oldforms? > > -- > > regards > kghttp://law

Re: Populating a form

2007-09-11 Thread Kenneth Gonsalves
On 11-Sep-07, at 11:45 AM, AniNair wrote: >I am trying to learn python and django. Can someone please tell me > how to populate some fields in a form newforms or oldforms? -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~~

Re: Populating a form

2007-09-11 Thread MikeHowarth
You'll need to load an instance of the model, which will pre-populate the data: http://www.djangoproject.com/documentation/newforms/#form-for-instance On Sep 11, 7:15 am, AniNair <[EMAIL PROTECTED]> wrote: > Hi... >I am trying to learn python and django. Can someone please tell me > how to

Re: Populating a form

2007-09-11 Thread Ole Laursen
On 11 Sep., 08:15, AniNair <[EMAIL PROTECTED]> wrote: >I am trying to learn python and django. Can someone please tell me > how to populate some fields in a form? I want to have certain values > present in CharField or Textfield . (Eg:For editing a profile: the > data previously entered need