Re: Initializing a ModelForm don't work - BUG ?

2010-03-30 Thread pjrhar...@gmail.com
On Mar 29, 12:24 pm, bruno desthuilliers wrote: > On 29 mar, 09:12, Thierry Chich wrote: > > > Le lundi 29 mars 2010 02:14:34, pjrhar...@gmail.com a écrit :> > OK. I can > > also put an hidden field in my form. I will evaluate what is > > > > the better option for me. > > > > Bear in mind if y

Re: Initializing a ModelForm don't work - BUG ?

2010-03-29 Thread bruno desthuilliers
On 29 mar, 09:12, Thierry Chich wrote: > Le lundi 29 mars 2010 02:14:34, pjrhar...@gmail.com a écrit :> > OK. I can > also put an hidden field in my form. I will evaluate what is > > > the better option for me. > > > Bear in mind if you exclude it from your form altogether there is > > nothing

Re: Initializing a ModelForm don't work - BUG ?

2010-03-29 Thread Thierry Chich
Le lundi 29 mars 2010 02:14:34, pjrhar...@gmail.com a écrit : > > OK. I can also put an hidden field in my form. I will evaluate what is > > the better option for me. > > Bear in mind if you exclude it from your form altogether there is > nothing to stop a malicious user setting it by modifying th

Re: Initializing a ModelForm don't work - BUG ?

2010-03-28 Thread pjrhar...@gmail.com
> OK. I can also put an hidden field in my form. I will evaluate what is the > better option for me. Bear in mind if you exclude it from your form altogether there is nothing to stop a malicious user setting it by modifying the post data. Peter -- You received this message because you are subsc

Re: Initializing a ModelForm don't work - BUG ?

2010-03-27 Thread Thierry Chich
Le samedi 27 mars 2010 19:23:04, Daniel Roseman a écrit : > On Mar 27, 4:34 pm, Thierry Chich wrote: > > I think I get the point. > > > > If I write > > obj=MyModel() > > obj.domaine=request.session.get("domaine") > > form=MyModelForm(instance=obj) > > if form.is_va

Re: Initializing a ModelForm don't work - BUG ?

2010-03-27 Thread Daniel Roseman
On Mar 27, 4:34 pm, Thierry Chich wrote: > I think I get the point. > > If I write >         obj=MyModel() >         obj.domaine=request.session.get("domaine") >         form=MyModelForm(instance=obj) >         if form.is_valid(): >                 form.save() > > It works (but I didn't populate m

Re: Initializing a ModelForm don't work - BUG ?

2010-03-27 Thread Thierry Chich
I think I get the point. If I write obj=MyModel() obj.domaine=request.session.get("domaine") form=MyModelForm(instance=obj) if form.is_valid(): form.save() It works (but I didn't populate my form) So it seems that the data provided in data=request.P

Re: Initializing a ModelForm don't work

2010-03-27 Thread Thierry Chich
Le samedi 27 mars 2010 14:39:40, Thierry Chich a écrit : > Hello all > > I have a problem to understand something. I could find some workaround > easily, but I don't want it. I want to understand. > > So this if the situation. I have a modelForm (MyModelForm) that is build on > a model (MyModel

Initializing a ModelForm don't work

2010-03-27 Thread Thierry Chich
Hello all I have a problem to understand something. I could find some workaround easily, but I don't want it. I want to understand. So this if the situation. I have a modelForm (MyModelForm) that is build on a model (MyModel) with one field mandatory (domaine - and it is a Foreignkey). I don't