django-bootstrap-modal-forms icon indicating copy to clipboard operation
django-bootstrap-modal-forms copied to clipboard

Generic modal forms with single template?

Open Crazor opened this issue 4 years ago • 1 comments
trafficstars

I have a project with a good number of ModelForms that use crispy_forms to render. All forms use one of two templates, because all the magic happens within ModelForms and crispy. Similar situation for my tables, I render them with django_tables2 from a single template. This is of course unrelated to my Q, I just wanted to show that I have deliberately set all this up to not need many templates.

I now tried to incorporate DBMF into my project for Create/Update views, where I want to render with BSModalModelForm to modals to improve usability. However, I'm not quite sure if it is possible at all to work with DBMF without having a template for each and every form in my project, as this would be rather impractical and mostly lots of duplication, due to the sheer number of forms I have.

What I'm struggling with is how to do stuff like setting formURL and setup of async submit from Python instead of from the template, and in a generic way, i.e. from a BSModalCreateView or BSModalModelForm.

Crazor avatar Apr 12 '21 13:04 Crazor

When you said templates, are you referring for the corresponding Create and Update templates ?

Are you interesting to use just 1 Template for the two function Create and Update ?, if yes I already use just one Template .html file for Create and Update function.

If you are interested, let me know.

Thank you.

infosrabah avatar Apr 18 '21 15:04 infosrabah