class UserForm forms Form login form CharField def __init__ self args

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
class UserForm(forms.Form):
login = form.CharField()
def __init__(self, *args, *kwargs):
self.user = kwargs.get('user')
super(UserForm, self).__init__(*args, **kwargs)
def save(self):
login = self.cleaned_data['login']
user = form.save_instance(self, user)
return user