Paulo - Just to follow-up, I tried the patch (4092_9912_nullselect.diff), but it being about 1500 checkins out of date, it only half worked.
In my forms.py, I ended up overriding the USStateSelect with a hack: class HackedUSStateSelect(Select): def __init__(self, attrs=None): from django.contrib.localflavor.us.us_states import STATE_CHOICES STATE_CHOICES = (('',u'---------'),) + STATE_CHOICES super(HackedUSStateSelect, self).__init__(attrs, choices=STATE_CHOICES) Unless someone has a better suggestion, I think I'll live with it and try to help with getting ticket 4092 into trunk ... - John On Aug 5, 1:49 pm, Paulo Almeida <igcbioinformat...@gmail.com> wrote: > Did you see this ticket? > > http://code.djangoproject.com/ticket/4092 > > Maybe you can use the patch code to customize your field. > > - Paulo > > On Wed, Aug 5, 2009 at 8:01 PM, JHeasly <jhea...@earthlink.net> wrote: > > > The doc page "Creating forms from models" > > (http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#topics- > > forms-modelforms<http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#topics-...> > > ) > > describes how > > "If the model field has choices set ... [snip] ... The choices will > > normally include the blank choice which is selected by default. ... " > > > I have a form that's not associated with a database model (i.e., > > form.Form) and I'm using the USStateSelect widget, but the blank > > choice isn't included in the STATE_CHOICE list. When the form loads, > > what I get is "Alabama" selected by default. I'd like to get the > > forms.ModelForm-style blank choice default selection behavior. > > > I'm guessing some sort of super() def __init__ trickery is called for > > but am stumped so far ... > > > Thanks, > > John > > --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---