Hi,

Try this below code. I guess this will solve your purpose

 # pull a recordset of the users
 userdata = auth_user.objects.all()

 def user_filler(self):
     for i in userdata:
         self[i.id] = '%s, %s', (i.firstname, i.lastname)
     return self.items()

Regards,
Lokesh

On May 17, 9:41 pm, Bobby Roberts <tchend...@gmail.com> wrote:
> > p=Country.objects.all()   -----> capturing all the records from
> > Country table
> > def country_filler(self):    -----> function  to generate a country
> > list which we are going to fetch from the records
> >     incr = 0
> >     for i in p:
> >        self[incr] = i.country
> >        incr = incr+1
> >     return self.items()
>
> > country = forms.CharField(label="cnty",
> > widget=forms.CheckboxSelectMultiple(choices=country_filler
> > (country_list)))
>
> ok here's what i have based on that example:
>
> from django import forms
>
> # pull a recordset of the users
> userdata = auth_user.objects.all()
>
> def user_filler(self):
>     counter=0
>     for i in userdata:
>         self[counter] = i.username
>         counter=counter+1
>     return self.items()
>
> #used to post messages to other users
> class FrmMessage (forms.Form):
>     posted_to = forms.ChoiceField
> (required=True,widget=forms.CheckboxSelectMultiple(attrs=
> {'class':'optchecklist'},choices=user_filler(userdata)))
>     message = forms.CharField (max_length=300, required=True,
> widget=forms.Textarea(attrs={'class':'smallblob'}))
>
> two questions.
>
> 1.  first, is this right?
> 2.  secondly, how can i pass the auth_user.id and the right
> auth_user.username back to the form?  This example seems to just send
> one back.  I need the value of the checkboxes to be the id and the
> visible text to be the firstname + lastname
>
> The idea is to let them choose to whom they want to send a quick
> message
--~--~---------~--~----~------------~-------~--~----~
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