Fantastic! that fixed it.

Thank you soo much, been driving me crazy for days now,

Pete

On Feb 20, 4:40 pm, Daniel Roseman <roseman.dan...@googlemail.com>
wrote:
> On Feb 20, 2:40 pm, pete <pet...@gmail.com> wrote:
>
>
>
> > Hi Daniel,
>
> > This has got me closer but i'm now just getting an empty select box
> > appearing on in the form, with no data in.
>
> > class NewBugForm(forms.Form):
> >   assigned_to = forms.CharField(max_length=50,widget=forms.Select
> > (choices=[]), initial='Anyone',required=False)
>
> >   def __init__(self, *args, **kwargs):
> >       all_users = kwargs.pop("all_users")
> >       super(NewBugForm, self).__init__(*args,**kwargs)
> >       print all_users
> >       self.fields['assigned_to'].choices = all_users
>
> > If I print out all_users I can see it is there after the super(), but
> > for some reason its not appending to the form. The following is a
> > print out of all_users:
>
> > (('Anyone', 'Anyone'), ('Pete Randall', 'Pete Randall'), ('Chris
> > Smith', 'Chris Smith'))
>
> > Could it have something to do with that list not being in the right
> > format?
>
> > Cheers,
>
> > Pete.
>
> My mistake, the last line should be:
>         self.fields['assigned_to'].widget.choices = all_users
>
> That should work.
> --
> DR.
--~--~---------~--~----~------------~-------~--~----~
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