Re: Forms: Set default value

2009-07-15 Thread Fred Chevitarese
I guess you can use the choices in the form that you´ve created! class AuthorForm(forms.Form): name = forms.CharField(max_length=100) title = forms.CharField(max_length=3, widget=forms.Select(choices=TITLE_CHOICES)) birth_date = forms.DateField(required=False) Take a l

Re: Forms: Set default value

2009-07-15 Thread Wiiboy
Sorry, I was little unclear above. I need to set the default for a form. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To uns

Re: Forms: Set default value

2009-07-15 Thread Fred Chevitarese
You can set the default choice in the model like this. SEARCH_CHOICES = ( ('G', 'google'), ('Y', 'Yahoo'), ('L', 'Live Search'), ) Now, your model will be set like this... class anything(models.Model): title = models.CharField(max_length = 80) search_engine = models.CharFiel

Forms: Set default value

2009-07-14 Thread Wiiboy
Hi, I'm defining a form model, and I have a choice field. I have the values in order, and I want one value (in the middle of the values in order) to be the default. How do I do that? Passing initial= anything doesn't work. --~--~-~--~~~---~--~~ You received this