On Friday 26 Mar 2010 3:38:10 pm Emanuel wrote:
> both combo's.
> I want to filter only men or women depending the case. Is it possible? Or
> should I create another method for independent cases? If it is the
> solution how can I use it? I'm not getting there because it is a instance
> of a class...
>
one way is to override __init__. Here is a sample:
class Accountaddform(ModelForm):
def __init__(self,head,*args,**kwargs):
super (Accountaddform,self).__init__(*args,**kwargs)
self.head = head
self.fields['head'].queryset=Account.objects.filter(pk=self.head)
class Meta:
model = Account
--
regards
Kenneth Gonsalves
Senior Associate
NRC-FOSS
http://certificate.nrcfoss.au-kbc.org.in
--
You received this message because you are subscribed to the Google Groups
"Django users" 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.com/group/django-users?hl=en.