Wednesday, February 2, 2011

Modifying form values before redirect

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})

--
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.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate