Open gjost opened 1 year ago
django-bootstrap-modal-forms - https://github.com/trco/django-bootstrap-modal-forms
successURL
, which 1) converts data to rolepeople JSON, 2) loads object*, 3) inserts new rolepeople data, and 4) redisplays form.Problem: If we reload the object we lose any changes the user made to other fields in the form. Idea: The button which triggers the modal form also saves the current form data to the session?
django-bootstrap-modal-forms isn't really meant for this use-case.
A combination of dynamic models with tabular inline objects from the Django admin:
The Django admin has the idea on inline objects (https://docs.djangoproject.com/en/4.1/ref/contrib/admin/#inlinemodeladmin-objects) that can be tabular or stacked. Django uses this to represent foreign key relationships e.g. a parent object and child objects.
It's possible to have Django object classes where Django does not create or manage database tables (https://docs.djangoproject.com/en/4.1/ref/models/options/#managed).
We could create e.g. an Entity class with associated Person classes.
PROBLEM: How to create these classes dynamically i.e. from ddr-defs
?
DynamicModels - https://code.djangoproject.com/wiki/DynamicModels django-dynamic-models - https://github.com/rvinzent/django-dynamic-models
https://stackoverflow.com/questions/31835362/using-dynamic-models-in-django-framework "This a use case for which Django isn't really good. It might be more costly to fight against the abstractions provided by Django's model layer, than to just use psycopg2 or whatever other adapter is appropriate for your data."
Datatables or inline formsets from django-jinja-knockout? https://django-jinja-knockout.readthedocs.io/
Maybe easier to use WTForms (https://wtforms.readthedocs.io/) because disconnected from any database backend.
WTForms Dynamic Fields https://github.com/timusan/wtforms-dynamic-fields Simple wrapper to add "dynamic" (sets of) fields to an already instantiated WTForms form.
Django Formsets - a layer of abstraction to work with multiple forms on the same page. https://docs.djangoproject.com/en/4.1/topics/forms/formsets/
I think this lets you have multiple instances of a form on a page, and add/delete them. So this might be used for a breakout page where you have a formset for each Person.(?) ...which might work with django-bootstrap-modal-forms or with a wizard.
django-formtools form wizard - https://django-formtools.readthedocs.io/en/latest/wizard.html "The form wizard application splits forms across multiple Web pages. It maintains state in one of the backends so that the full server-side processing can be delayed until the submission of the final form."
We might break out the creators and/or persons fields into a separate page managed by the wizard.
This seems a lot easier than dynamic models, but would hard-code these fields into the app, which is what we made ddr-defs
to avoid.
What about using the TagManager widget we're using for Topics?
Scratchpad for gathering ideas for a better way to present Persons in a form than a big textarea where users must format data themselves.
Two(?) basic approaches:
Right now we're just collecting ideas. No judgements about (in-)feasability at this point.