Hello,

I have:

class SomeForm(forms.Form):
    ...

    def __init__(self, *args, **kwargs):
        ...
        super(SomeForm, self).__init__(*args, **kwargs)
        ...
        self.fields['starting_location'] = forms.TypedChoiceField(
            label=_('Starting location'),
            choices=DIRECTIONS_CHOICES,
            coerce=int
        )


Now I want to choose as initial selection one random item from DIRECTIONS_CHOICES choices but I have to do it in this __init__() method (not in view!). How can I achieve this?

Thanks,
Martin

--
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.

Reply via email to