FormWizard: how to pass in extra keyword arguments into a form's __init__?

10 views
Skip to first unread message

Berco Beute

unread,
Aug 31, 2009, 5:41:28 AM8/31/09
to Django users
One of the forms I'm using in a FormWizard takes an aditional keyword
argument in its __init__, e.g.:

=============
def __init__(self, arg1=None, *args, **kwargs):
pass
=============

I'm at a loss how to make FormWizard construct my form while passing
in the extra keyword argument (arg1). Any ideas?

Thanks,

Alex Robbins

unread,
Sep 1, 2009, 9:20:06 AM9/1/09
to Django users
I guess the question is when you know the additional keyword argument.
If you already know what that extra keyword is when you are
constructing the form list, you could use a partial[1] to put in the
arguments you know already. Partials are python 2.5+ only, you can use
a lambda instead if you are stuck on 2.4. That doesn't help if you
need the kwarg to come at run time though.

[1] http://docs.python.org/library/functools.html#functools.partial
Reply all
Reply to author
Forward
0 new messages