OK, I figured out the array type in Postgresql to get this to work.
Now, the challenge is to read through the array when I am displaying the
values and match them up with the choices in the model.

/alex

On Dec 23, 2007 12:20 PM, Alex Ezell <[EMAIL PROTECTED]> wrote:

> Tim,Sorry for the late reply, but I'm just now getting around to this.
>
> This definitely gives me the widget I want and the Forms class is happy,
> but I can't seem to find anything about what type of DB field or Model field
> this should be.
>
> The errors I get say that the value posted is of type text[], but I'm not
> sure how to cast that or whatever to get the database to accept and then of
> course be able to edit it or display it.
>
> Thanks!
>
> /alex
>
>
> On Dec 18, 2007 10:46 AM, Tim < [EMAIL PROTECTED]> wrote:
>
> >
> > Try this:
> >
> > credentials =
> > forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple ,
> > choices=Truckshare.CREDENTIALS_CHOICES)
> >
> > On Dec 17, 9:14 pm, "Alex Ezell" <[EMAIL PROTECTED]> wrote:
> > > I have several fields define in my models like this:
> > > CREDENTIALS_CHOICES = (
> > >         ('LM', "Commercial Driver's License"),
> > >         ('IN', 'Insured'),
> > >         ('DR', 'DOT Registered (Interstate)'),
> > >         ('FI', 'Fragile Item Qualified'),
> > > )
> > > credentials = models.CharField(max_length=2, blank=True,
> > > choices=CREDENTIALS_CHOICES)
> > >
> > > Then, I have them described in my form class as this:
> > >
> > > credentials = forms.ChoiceField(choices=Truckshare.CREDENTIALS_CHOICES
> > )
> > >
> > > What I would like to do is use a CheckboxSelectMultiple for this
> > field.
> > > However, when I do that like this:
> > >
> > > credentials = forms.ChoiceField(choices=Truckshare.CREDENTIALS_CHOICES
> > > ,widget=CheckboxSelectMultiple)
> > >
> > > but that will fail because it will submit multiple values to the model
> > and
> > > since it's ChoiceField, it will complain.
> > >
> > > How can I set this up so that I can use choices in my model and use a
> > > CheckboxSelectMultiple field via newforms?
> > >
> > > Thanks!
> > >
> > > /alex
> > > >
> >
>

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

Reply via email to