Re: prepopulate form with model instance values using UpdateView and ModelForm

2017-01-19 Thread Benjamin Dauer
Hi Sergiy, Thanks for your help! 1) I tried overriding the GET request as you suggested and the print statement never went through. It looks like by default it calls `get_object()`, and my `get_object()` code is running, so I'm not sure why it doesn't appear. 2) The form is appearing with the co

Re: prepopulate form with model instance values using UpdateView and ModelForm

2017-01-19 Thread Benjamin Dauer
Hi Sergiy, Thanks for your help! 1) I tried overriding the GET request as you suggested and the print statement never went through. It looks like by default it calls `get_object()`, and my `get_object()` code is running, so I'm not sure why it doesn't appear. 2) The form is appearing with the co

Re: prepopulate form with model instance values using UpdateView and ModelForm

2017-01-18 Thread Sergiy Khohlov
Hello, I had a similar problem (but I'm using DetailView for sending some additional data) and I hope I can help Usually editing page is using GET for receiving default data and POST for sending data from form to view ( we are skipping ajax way) 1) You would like to set initial data to th

Re: prepopulate form with model instance values using UpdateView and ModelForm

2017-01-18 Thread Melvyn Sopacua
On Wednesday 18 January 2017 14:26:52 Benjamin Dauer wrote: > Hi Melvyn, > > That's exactly what I'm trying to do, but prior to making the changes > it wasn't prepopulating. At each stage I tested and was getting blank > fields albeit based off of the correct model. > > Maybe it's because I don't

Re: prepopulate form with model instance values using UpdateView and ModelForm

2017-01-18 Thread Benjamin Dauer
Hi Melvyn, That's exactly what I'm trying to do, but prior to making the changes it wasn't prepopulating. At each stage I tested and was getting blank fields albeit based off of the correct model. Maybe it's because I don't provide the pk in the URL? I was trying to avoid that. On Wed, Jan 18, 2

Re: prepopulate form with model instance values using UpdateView and ModelForm

2017-01-18 Thread Melvyn Sopacua
On Wednesday 18 January 2017 04:44:01 dauer.benjamin wrote: > Question for you all. Appreciate any insight you can give. So I have a > class-based view (UpdateView) and a ModelForm. I want the form to > pre-populate with data from a model instance. It feels like you're doing work that's already d