On Aug 6, 3:34 pm, Julián C. Pérez <jcp...@gmail.com> wrote: > Hi > I tried doing that... > But it does not work > For example, if I do something like... > --- > class SendMessageForm(forms.Form): > recipientUser = ShowValidContactList(label=u'Send to') > messageSubject= forms.CharField(label=u'Subject') > messageContent = forms.CharField > (label=u'Content',widget=forms.Textarea()) > def __init__(self, currentUser): > self.currentUser = currentUser > super(SendMessageForm, self).__init__(*args, **kwargs) > --- > that init method in my custom form class won't change anything in the > already defined ShowValidContactList field
Because you are clobbering the existing parameters to __init__. You should do it like this: def __init__(self, *args, **kwargs): self.currentUser = kwargs.pop('currentUser', None) super(SendMessageForm, self).__init__(*args, **kwargs) -- 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 -~----------~----~----~----~------~----~------~--~---