Re: Populating a form from the database

2009-08-05 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

Populating a form from the database

2009-08-04 Thread Magnus Valle
Short: How do I populate a form with data from the database? Fx. if I want to let users edit the data they have entered. Long: Currently, I have a form where the user(if logged in) will enter data and when it is submitted some extra data is entered to the form before it is saved, a time-stamp

DateField format with a ModelForm: populating the form from a model instance

2008-12-07 Thread alex_t
Hi, I've written my own view to create / edit model instances my project, and part of what I wanted to do was to accept dates only in the format dd-mm- (%d-%m-%Y). I searched around a bit and came accross this post:

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:

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

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 >

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

Populating a form

2007-09-11 Thread AniNair
Hi... 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 needs to be present in the resp fields...) Please help.