Re: newforms + testing

2007-05-28 Thread [EMAIL PROTECTED]
New update, I used ModelChoiceFields and ModelMultipleChoiceFields. Problem solved :) On May 23, 9:01 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hello, > > I wrote a newforms form, but I have some problems when I want to test > the class. Here's the definition: > > def _users(): >

Re: newforms + testing

2007-05-23 Thread Malcolm Tredinnick
On Wed, 2007-05-23 at 06:01 -0700, [EMAIL PROTECTED] wrote: > Hello, > > I wrote a newforms form, but I have some problems when I want to test > the class. Here's the definition: > > def _users(): > print "calling _users()" > return [(u.id, u.get_full_name()) for u in > User.objects.fil

Re: newforms + testing

2007-05-23 Thread Doug B
If you put the call to your _users() function in the form __init__() I think it will be what you are looking for. initi s called automatically whenever an instance is created. class MemoForm(forms.Form): -snip- def __init__(self,*args,**kwarg) super(MemoForm,self).__init__(*args,**kw

Re: newforms + testing

2007-05-23 Thread Doug B
If you put the call to your _users() function in the form __init__() I think it will be what you are looking for. initi s called automatically whenever an instance is created. class MemoForm(forms.Form): -snip- def __init__(self,*args,**kwarg) super(MemoForm,self).__init__(*args,**kw

Re: newforms + testing

2007-05-23 Thread Doug B
If you put the call to your _users() function in the form __init__() I think it will be what you are looking for. initi s called automatically whenever an instance is created. class MemoForm(forms.Form): -snip- def __init__(self,*args,**kwarg) super(MemoForm,self).__init__(*args,**kw

Re: newforms + testing

2007-05-23 Thread [EMAIL PROTECTED]
I fixed my problem, but it's very much a hack. If anyone has a better solution, please post it. My fix was a simple hack: after every instantiation of my MemoForm class, I called a method "replace_recipients" where I changed the value of form_object.base_fields['recipients'].choices. Like I sai

Re: newforms + testing

2007-05-23 Thread [EMAIL PROTECTED]
I fixed my problem, but it's very much a hack. If anyone has a better solution, please post it. My fix was a simple hack: after every instantiation of my MemoForm class, I called a method "replace_recipients" where I changed the value of form_object.base_fields['recipients'].choices. Like I sai

Re: newforms + testing

2007-05-23 Thread [EMAIL PROTECTED]
I fixed my problem, but it's very much a hack. If anyone has a better solution, please post it. My fix was a simple hack: after every instantiation of my MemoForm class, I called a method "replace_recipients" where I changed the value of form_object.base_fields['recipients'].choices. Like I sai

Re: newforms + testing

2007-05-23 Thread [EMAIL PROTECTED]
I fixed my problem, but it's very much a hack. If anyone has a better solution, please post it. My fix was a simple hack: after every instantiation of my MemoForm class, I called a method "replace_recipients" where I changed the value of form_object.base_fields['recipients'].choices. Like I sai

newforms + testing

2007-05-23 Thread [EMAIL PROTECTED]
Hello, I wrote a newforms form, but I have some problems when I want to test the class. Here's the definition: def _users(): print "calling _users()" return [(u.id, u.get_full_name()) for u in User.objects.filter(is_active=True)] class MemoForm(forms.Form): body = forms.CharField(w