Re: QueryDict instance is immutable

2007-03-12 Thread limodou

On 3/13/07, Grupo Django <[EMAIL PROTECTED]> wrote:
>
> Hi!
> I have created a form using newforms, and one field is author which I
> want to fill using the current username, I did this:
> request.POST['author']="Username I want"
> and I got this error:
> "QueryDict instance is immutable"
> Ok, what should I do? I thought about create a hidden widget for this
> field, but that's not secure enough.
> Is there a way to do what I want?
>
> Thank you!
>
You can do like this:

old = request.POST._mutable
request.POST._mutable = True
for k, v in args.items():
request.POST[k] = v
request.POST._mutable = old

But except you have strong idea, I don't suggest that you do like
above. You can copy() it and the new instance can be changed.

-- 
I like python!
UliPad <>: http://wiki.woodpecker.org.cn/moin/UliPad
My Blog: http://www.donews.net/limodou

--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



QueryDict instance is immutable

2007-03-12 Thread Grupo Django

Hi!
I have created a form using newforms, and one field is author which I
want to fill using the current username, I did this:
request.POST['author']="Username I want"
and I got this error:
"QueryDict instance is immutable"
Ok, what should I do? I thought about create a hidden widget for this
field, but that's not secure enough.
Is there a way to do what I want?

Thank you!


--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---