Thursday, February 3, 2011

Re: Modifying form values before redirect

On Thursday, February 3, 2011 2:09:56 AM UTC, Osiaq 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})

Why didn't you show the code that does the modifying and causes the error? 
--
DR.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment