単純な Python クラスのように、さまざまな方法でパラメーターを渡すことができます。Django フォーム/モデルフォームのデフォルトの動作を壊さないように注意する必要があります。
class YourForm(forms.Form):
def __init__(self, custom_arg=None, *args, **kwargs):
# We have to pop the 'another_arg' from kwargs,
# because the __init__ from
# forms.Form, the parent class,
# doesn't expect him in his __init__.
self.another_arg = kwargs.pop('another_arg', None)
# Calling the __init__ from the parent,
# to keep the default behaviour
super(YourForm, self).__init__(*args, **kwargs)
# In that case, just our __init__ expect the custom_arg
self.custom_arg = custom_arg
print "Another Arg: %s" % self.another_arg
print "Custom Arg: %s" % self.custom_arg
# Initialize a form, without any parameter
>>> YourForm()
Another Arg: None
Custom Arg: None
<YourForm object at 0x102cc6dd0>
# Initialize a form, with a expected parameter
>>> YourForm(custom_arg='Custom arg value')
Another Arg: None
Custom Arg: Custom arg value
<YourForm object at 0x10292fe50>
# Initialize a form, with a "unexpected" parameter
>>> YourForm(another_arg='Another arg value')
Another Arg: Another arg value
Custom Arg: None
<YourForm object at 0x102945d90>
# Initialize a form, with both parameters
>>> YourForm(another_arg='Another arg value',
custom_arg='Custom arg value')
Another Arg: Another arg value
Custom Arg: Custom arg value
<YourForm object at 0x102b18c90>