I see. We are using Bootbox for our modals, but I’m sure the concept is the same.
We have a separate template of the form that we include when we initialize the page. We have an event listener on the modal button, so that when it is clicked, it replaces the HTML inside the form with the HTML returned by our ajax view. In order to get a specific object, we use the querystring to pass the PK of the object to retrieve in the ajax view. We have a save button on our modal form, and that POSTs back to the same ajax view. If it does not validate, we return the HTML of the form with validation errors; otherwise, we send back a success message so that the event handler on the save button can close the modal or reload the page or do something else. That is probably as clear as mud… From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Michael Chenetz Sent: Friday, March 3, 2017 2:37 PM To: Django users Subject: Re: How do you populate an update form in a Bootstrap Modal? Thanks... I do use the instance variable. I think it has more to do with the modal itself. I see some sites that indicate and ajax call is needed. Not sure what to do there. On Friday, March 3, 2017 at 3:10:40 PM UTC-5, Michael Chenetz wrote: I am trying to figure out how to populate the update model form in a Bootstrap Modal. I can add to a form no problem but update does not seem to pre-populate the form when it is viewed. I need to understand what i need to do in the view/template to get this done. Any help would be greatly appreciated. Regards, Mike -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com<mailto:django-users+unsubscr...@googlegroups.com>. To post to this group, send email to django-users@googlegroups.com<mailto:django-users@googlegroups.com>. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/24087ac2-5f69-4818-82a1-842fd0c52830%40googlegroups.com<https://groups.google.com/d/msgid/django-users/24087ac2-5f69-4818-82a1-842fd0c52830%40googlegroups.com?utm_medium=email&utm_source=footer>. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7bb7c299e1b6494e871eb2f3b1f6c8fd%40ISS1.ISS.LOCAL. For more options, visit https://groups.google.com/d/optout.