Niall Kelly wrote:
> Ah I was looking for a way of specifying the initial values for the form 
> field (so they would have selected="selected" in the HTML) rather than 
> the options to pick from. Similar to how you would set the initial text 
> for an unbound CharField in a form.

http://docs.djangoproject.com/en/dev/topics/forms/formsets/#using-initial-data-with-a-formset
 
Seems to cover it. I was doing this myself last week. So as well as the 
QuerySet for your choices, you just provide initial for the default 
selected item.

Hope that helps..

> 
> Niall
> 
> [EMAIL PROTECTED] wrote:
>> Pass a tuple with the choices to your model
>>
>> blah_choices = (('One', '1'),('two','2'))
>>
>> blahs = models.CharField(_(u'blah'), blank=True, null=True,
>> max_length=64, choices=blah_choice, default='blah')
>>
>> J
>> On Dec 8, 5:16 pm, Niall Kelly <[EMAIL PROTECTED]> wrote:
>>   
>>> Hi all,
>>>
>>> Does anybody know how to set initial values for MultipleChoiceFields
>>> (akin to how in the admin interface ManyTo* relationships have a select
>>> box)? I've tried setting it's it to a list of values or individual value
>>> but no luck. This is part of a formset so the initial values are
>>> dictionaries.
>>>
>>> Thanks,
>>> Niall
>>>     
>>>
>>   
> 
> 
> > 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Python Ireland" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.ie/group/pythonireland?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to