Thanks Jake. It works like a charm. I thought I tried this before, so I obviously made some mistake.
Thanks, Amit > > hi amit, > > Amit Ramon wrote: > > units = models.CharField(maxlength=2, choices=UNITS) > > > > When I try to create a new instance of this model in the admin, the initial > > value in the select list for the units field is a dashed line. What I'd like > > is to be able to define an initial value for this field, and have it already > > selected in the select list when I just enter the "add object" page. I've > > tried using the default keyword argument in various ways but to no avail. > > the 'default' keyword argument should work, but be sure to use the > stored-value (first) element from the stored/representation tuple you use. > > ie if your UNITS tuple is defined > > >>> UNITS = ( ('in', 'Inches'), ('cm', 'Centimeters'), ) > > you'll want to use > > >>> class MyModel(models.Model): > >>> units = models.CharField(maxlength=2, choices=UNITS, default='cm') > > -jake > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---