Re: [flask] Understand piece of code
- Andy Dirnberger
- 2013-07-31 @ 21:15
I suspect that this is the model_form you're using:
On Wed, Jul 31, 2013 at 5:10 PM, Andy Dirnberger <firstname.lastname@example.org>wrote:
> I suspect that model_form creates and returns a new type, which is then
> referenced by MyForm.
> form = MyForm(request.form, model) would then call Form.__init__,
> providing it both request.form and an instance of MyModel.
> On Wed, Jul 31, 2013 at 4:08 PM, Julien Debaru <email@example.com> wrote:
>> Hi everybody,
>> I'm learning Flask (And Python in same time), and i don't understand a
>> piece of code.
>> Code is here :
>> MyForm = model_form(MyModel, Form)
>> model = MyModel.get(id)
>> form = MyForm(request.form, model)
>> I don't understand how it's possible to put "request.form" and "model"
>> in MyForm. How it works ? If anybody can explain me, i'd be grateful.