django: how to access current request user in ModelForm?
If you’re using Class Based Views (CBVs) then passing an extra argument in the form constructor (e.g. in get_forms_class) or in form_class will not work, as <form> object is not callable will be shown. The solution for CBVs is to use get_form_kwargs(), e.g.: views.py: class MyUpdateView(UpdateView): model = MyModel form_class = MyForm # Sending user … Read more