Thanks Melvyn... I am not having issues with a generic update form. The 
problem is when using it in a Bootstrap Modal. I think it is a 
javascript/ajax issue. That is the piece I need to figure out.

Mike

On Sunday, March 5, 2017 at 10:48:22 AM UTC-5, Melvyn Sopacua wrote:
>
> Hi Michael,
>
>  
>
> Disclaimer: leaving the Javascript side of things out of scope.
>
>  
>
> On Friday 03 March 2017 12:07:16 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.
>
>  
>
> Look at how ModelFormMixin 
> <https://ccbv.co.uk/projects/Django/1.10/django.views.generic.edit/ModelFormMixin/>
>  
> does it:
>
>    1. get_content_data from FormMixin calls get_form() 
>    2. this gets the form class and calls get_form_kwargs() 
>    3. ModelFormMixin injects the 'instance' keyword argument for the 
>    ModelForm
>
> So, in order to prepopulate the form in the modal you need to provide the 
> instance argument and assign it the model instance. I assume you know what 
> model instance you need to update.
>
> -- 
>
> Melvyn Sopacua
>

-- 
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/2c0e07f3-bed2-425d-a3b2-ed6e16863c34%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to