Thanks for the pointer. This does indeed change the default value to 'Male' but the select-box still offers the dashes...
I want to eliminate the dashes-option completely, why give the user a choice that will never be accepted? -mark On Mon, 2007-09-10 at 06:47 +0000, Ryan wrote: > Use initial when calling your form class. > > formClass = forms.form_for_model(Person) > form = formClass(initial={'gender': 'm'}) > > On Sep 6, 4:31 pm, Mark Green <[EMAIL PROTECTED]> wrote: > > Hi all, > > > > This is my model: > > > > class Person(models.Model): > > GENDER_CHOICES = ( > > ( 'm', 'Male' ), > > ( 'f', 'Female' ), > > ) > > gender = models.CharField( blank=False, "gender", maxlength=1, > > choices=GENDER_CHOICES, default='m' ) > > > > Using form_for_model() on the above model results in HTML like this: > > > > <select name="gender" id="id_gender"> > > <option value="" selected="selected">---------</option> > > <option value="m">Male</option> > > <option value="f">Female</option> > > </select> > > > > How do I get rid of the first option (the dashes)? > > I would prefer to have the <select>-widget default to my default-value. > > > > Any help appreciated! > > > > -mark --~--~---------~--~----~------------~-------~--~----~ 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 unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---