简体   繁体   中英

How to pass parameters to a form from a class based View with Django 1.8?

excuse my english

I'd like to pass a parameter to the constructor of a form from a FormView. But, because when I use class based views, I'm not the one that create the form object so I am unable to do it this way .

I know maybe the best thing to would be to use a function view instead of a class based view, but does anyone know a way to do it using class based views ?

你不说你使用的是什么类型的基于类视图,但任何继承FormMixin有方法get_form_kwargs正是这个目的。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM