Many to Many Wtforms Flask Sqlalchemy

Asked

Viewed 118 times

1

Good night!

I’m implementing a system with wtforms flask, and I 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 the surveys I performed only I find example of "Selectfield" (combo), but I need a grid to add product items in this budget. Would anyone have an orientation, example or tips on how to accomplish this implementation? I am with the idea of creating a 3 class (Itemorcamento), point out the Fks (Product and Budget) and treat in coding the CRUD of items.

I’m waiting, a hug!!!

1 answer

1


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

The experience I had with Wtforms is that it works very well for simple forms. Already with complex form (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 synchronize the HTML form with the Wtforms form.

When I have to use these more robust forms, I use some client-side library (Angular, for example), create the 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 kind of construction. But, in my view, it is quite boring to use =X

I hope I’ve helped!

  • In the end I gave up doing this format, and I moved to Django with REST Framework. With Flask’s Rest it was easier too!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.