Re: How to populate fields generated by modelformset_factory with data from database

2020-08-08 Thread Integr@te System
Hi Micheal, https://docs.djangoproject.com/en/3.0/topics/forms/formsets/ You see in doc with example such as custom queryset, initial data get from existed instances all base on your design and codebase. On Sat, Aug 8, 2020, 10:48 PM Michael Klassen wrote: > Hi, thank you for your response b

Re: How to populate fields generated by modelformset_factory with data from database

2020-08-08 Thread Michael Klassen
Hi, thank you for your response but I need some more specifics. My queryset includes the questions which the form presents to the user. How do I get their responses included in the queryset? Do I have to somehow join tables to get both questions and responses? If I follow the relationships

Re: How to populate fields generated by modelformset_factory with data from database

2020-08-07 Thread Integr@te System
Hi Michael, You can read queryset combine with model in modelformset_factory() method to get exact user and/or any fields you need as existed instance or base on cookies or sth like that to identify your user, depend on your use case(ex trigger events or choose one option...). Hope it helpful.

How to populate fields generated by modelformset_factory with data from database

2020-08-07 Thread Michael Klassen
Hello: I am using modelformset_factory to generate my form based on a model. If the user submits a page, then returns to it later, I would like to populate the fields with what they previously answered. I can only find examples of pre-populated fields with the extra forms; is there a way to d