Re: ModelForm initial= vs. instance=

2008-09-20 Thread David Durham, Jr.
> Basically, I store the cleaned_data in the session for POSTs and use > the cleaned_data in order to initialize a ModelForm for display after > GETs. Eventually, I have to save some things. When that happens, I > again get the data from a session: > >for i in range(len(self.get_form_li

Re: ModelForm initial= vs. instance=

2008-09-20 Thread David Durham, Jr.
> No, there's quite a difference. "Initial" is used to set the initial > values and is quite appropriate when a *new* model instance is going to > be created. The "instance" is used when you want the ModelForm to be > used to update an existing instance of a model. > Since Django does not > curren

Re: ModelForm initial= vs. instance=

2008-09-19 Thread Malcolm Tredinnick
On Fri, 2008-09-19 at 08:54 -0500, David Durham, Jr. wrote: > I'm writing a little wizard application to walk a user through > creating a bunch of Model objects. I stumbled across something kind > of interesting; if I create a ModelForm like so: > >SomeModelForm(initial={...}) > > All of t

ModelForm initial= vs. instance=

2008-09-19 Thread David Durham, Jr.
I'm writing a little wizard application to walk a user through creating a bunch of Model objects. I stumbled across something kind of interesting; if I create a ModelForm like so: SomeModelForm(initial={...}) All of the fields I have are prepopulated, except the ForeignKey ones. I don't hav