Re: Setting default values in a form from DB table

2011-10-24 Thread Swaroop Shankar V
Thank a lot Andre, this is my first project in Django so kind of confused at many parts. The links will help me to fix my issue. Thanks and Regards, Swaroop Shankar V On Mon, Oct 24, 2011 at 6:03 PM, Andre Terra wrote: > You should always populate your form in forms.py. This is done using th

Re: Setting default values in a form from DB table

2011-10-24 Thread Andre Terra
You should always populate your form in forms.py. This is done using the 'initial' kwarg and is thoroughly explained in the docs! [1] Borrowing from the tutorial's Poll model [2]: Class PollsForm(forms.Form): def __init__ (self, *args, **kwargs): self.instance = kwargs.pop('instance',

Setting default values in a form from DB table

2011-10-23 Thread Swaroop Shankar V
Hello All, I am trying to create a Edit form to edit user information. I would like to display the default values in the form fields rendered and am getting the values from the db table. I can take an approach by creating a dictionary with the values that needs to be populated in the form fields i