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 +, Ryan wrote:
> Use initial
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'
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
3 matches
Mail list logo