You simply need to provide a default value for your field, i.e. :
turtle_type = models.IntegerField(null=False, blank=False,
choices=TURTLE_TYPES, default=1)

See the notes on:
http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#field-types


hth,
Nuno

On Tue, May 25, 2010 at 10:05 PM, Joshua Frankenstein Lutes
<huz...@gmail.com> wrote:
> I have a Model that looks something like this:
>
> ==============================================
> class Turtle(models.Model):
> turtle_type = models.IntegerField(null=False, blank=False,
> choices=TURTLE_TYPES)
> ==============================================
>
> I use it to create a ModelForm:
>
> ==============================================
> class TurtleForm(forms.ModelForm):
> class Meta:
> model = Turtle
>
> widgets = {
> 'turtle_type': forms.RadioSelect,
> }
> ==============================================
>
> The problem is that when I display the TurtleForm, it shows a radio
> select for "---------", which correlates to a null option. This
> doesn't validate when the form is submitted and I don't want it to be
> a selectable option. How can I prevent this from being displayed?
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.

Reply via email to