utils: allow to set an attribute on __init__ method to tell they need the request parameter
This commit is contained in:
parent
fa24d2bba5
commit
0749e2205d
|
@ -38,6 +38,7 @@ class PasserelleRegisterForm(forms.Form):
|
|||
choices=choices, initial=initial,
|
||||
widget=widgets.CheckboxMultipleSelect,
|
||||
required=False)
|
||||
__init__.need_request = True
|
||||
|
||||
|
||||
def save(self):
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
def callable_has_arg(method, arg):
|
||||
if hasattr(method, 'need_'+arg):
|
||||
return getattr(method, 'need_'+arg)
|
||||
if hasattr(method, 'im_func'):
|
||||
varnames = method.im_func.func_code.co_varnames
|
||||
argcount = method.im_func.func_code.co_argcount
|
||||
|
|
Reference in New Issue