Thank you :) On Feb 3, 1:41 pm, Tom Evans <tevans...@googlemail.com> wrote: > On Thu, Feb 3, 2011 at 2:09 AM, Osiaq <osiaq.net...@gmail.com> wrote: > > Hi all! > > I'm receiving the form from index.html and redirecting to order.html > > I would like to change "customer" value before redirection. > > When I try to modify it, Im getting "object does not support item > > assignment" > > How can I change "customer" value posted from index.html ? > > Thank you! > > > ----------------------- models.py --------------------- > > class Order(models.Model): > > customer = models.CharField(max_length=20) > > email = models.EmailField() > > def __str__(self): > > return self.customer > > > class OrderForm(ModelForm): > > class Meta: > > model=Order > > > ----------------------- views.py --------------------- > > def order(request): > > form = OrderForm(request.POST) > > return render_to_response('order.html', {'form':form}) > > request.POST and request.GET are read-only MultiDicts, so if you want > to alter the contents, you would need to duplicate them, and replace > them with read-write copies: > > request.POST = request.POST.copy() > request.POST['foo'] = ''bar' > > Cheers > > Tom
-- 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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.