Many to Many WTForms Flask SQLAlchemy

0

Good evening!

I am implementing a system with wtforms flask , and stopped in the following situation: I have CRUD products and a CRUD Budget so I will have product items in the budget (n: n). In surveys I've done only with example "SelectField" (combo), but I need a grid to add product items in that budget. Would anyone have an orientation, example or tips on how to accomplish this implementation? I have the idea of creating a 3 class (ItemOrcamento), pointing the FKs (Product and Budget) and treating the CRUD of items in the encoding.

I'm waiting, a hug!

    
asked by anonymous 05.08.2016 / 05:37

1 answer

1

I saw the question asked a while ago but I will leave some suggestions here.

The experience I've had with WTForms is that it works great for simple forms. Already with complex formulas (with tables, dynamic content, client-side operations - with Angular, for example), I realized that it becomes a limiter. Sometimes you spend a lot of time trying to sync the HTML form with the WTForms form.

When I have to use these more robust types of forms, I use some client-side ( Angular ) library, I create JSON on the client side and treat it on the server side.

Another alternative is to use the concept of Dynamic Form Composition ( link ) that tries to predict this type of construction. But, in my opinion, it's pretty cool to use = X

I hope I have helped!

    
08.02.2017 / 15:40