Form.factory

41 views
Skip to first unread message

Jamesie Pic

unread,
Dec 18, 2017, 5:24:15 AM12/18/17
to django-d...@googlegroups.com
Hello everybody,

Currently, we can set extra request/view arguments in a form by overriding a CBV get_form* method. This way, we can add things such as request.user, if we also override the Form constructor to accept such arguments.

I'd like to suggest that we add a factory(cls, view) method to the Form class, and make CBV call self.form_class.factory(view, *ctor_args, **ctor_kwargs) as a way to keep the view->form variables logic in a single place.

Thanks for your time
Best regards
<3

--

Reply all
Reply to author
Forward
0 new messages