Re: ModelForm and request.POST

2008-09-30 Thread globophobe
Doh, I changed the prefix of my form. I get it now. Thank you Malcolm. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsub

Re: ModelForm and request.POST

2008-09-29 Thread globophobe
On Sep 30, 10:29 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > I strongly suspect you're debugging the wrong problem here. > > Regards, > Malcolm I am passing all the required arguments into the form. I wrote a simple dispatcher that parses request.POST into a dictionary of the form: {mode

Re: ModelForm and request.POST

2008-09-29 Thread Malcolm Tredinnick
On Mon, 2008-09-29 at 16:07 -0700, globophobe wrote: [...] > However, if I want to change an existing object it seems I must use > request.POST, i.e. > > f = ArticleForm(request.POST, instance=a) > > Because, > > f = ArticleForm({'title':'Old news'}, instance=a) > > In [64]: f.is_valid() > Ou

Re: ModelForm and request.POST

2008-09-29 Thread Alex Koshelev
If you what to provide some init state for form - use `initial` param On Sep 30, 2:31 am, globophobe <[EMAIL PROTECTED]> wrote: > I would like to instantiate a modelform with a dictionary to work with > an existing object, e.g. > > a = Article.objects.get(title='Big news') > f = ArticleForm({'tit

Re: ModelForm and request.POST

2008-09-29 Thread globophobe
Pardon me, it's early. What I mean to do is pass new data to the form to be saved to the object. If I create a new object with the ModelForm then it's OK to pass the data to the form in a dictionary, i.e. f = ArticleForm({'title':'Old news'}) In [60]: f.is_valid() Out[60]: True However, if I w

Re: ModelForm and request.POST

2008-09-29 Thread globophobe
On Sep 30, 7:39 am, Alex Koshelev <[EMAIL PROTECTED]> wrote: > If you what to provide some init state for form - use `initial` param I tried to use the 'intial' param, however, i = {'title':'Old news'} a = Article.objects.get(title='Big news') f = ArticleForm(initial=i, instance=a) In [50]: f.i

ModelForm and request.POST

2008-09-29 Thread globophobe
I would like to instantiate a modelform with a dictionary to work with an existing object, e.g. a = Article.objects.get(title='Big news') f = ArticleForm({'title':'Old news'}, instance=a) However, ModelForm seems to require request.POST rather than a dictionary, i.e. f = ArticleForm(request.POS