On Jun 13, 5:53 am, robo <[EMAIL PROTECTED]> wrote:
> if request.method == 'POST':
> form1 = form_for_model(Order)
> Orders = form1(request.POST, prefix='orders')
This is a bit confusing.
I'd suggest
OrderForm = form_for_model(Order)
order_form = OrderForm(request.POST, prefix='orders')
..
This is my view code for this implementation:
if request.method == 'POST':
form1 = form_for_model(Order)
Orders = form1(request.POST, prefix='orders')
form2 = form_for_model(Order_Detail)
Orders_Details = form2(request.POST, prefix='order_details')
if Orders.is_valid():
On Jun 6, 8:06 pm, robo <[EMAIL PROTECTED]> wrote:
> So when data containing fields from both models get POSTed. I would
> write (pseudo) code like so ?:
>
> if request.method == 'POST':
> ...
> Orders = form_for_model(Order)
> f = Orders(prefix='orders')
> Order_Details = form_for_model(Order_De
So when data containing fields from both models get POSTed. I would
write (pseudo) code like so ?:
if request.method == 'POST':
...
Orders = form_for_model(Order)
f = Orders(prefix='orders')
Order_Details = form_for_model(Order_Detail)
f2 = OrderDetails(prefix='order_details')
...
f.save()
f2.sav
On Jun 6, 10:00 am, robo <[EMAIL PROTECTED]> wrote:
> I'm wondering if someone can help me out with a similar problem. I'm
> trying to save to 2 different models (Order and Order_Detail, where in
> Order_Detail there is a foreign key to Order) from one click of the
> Submit button. How would I di
I'm wondering if someone can help me out with a similar problem. I'm
trying to save to 2 different models (Order and Order_Detail, where in
Order_Detail there is a foreign key to Order) from one click of the
Submit button. How would I distinguish the POSTed data between which
form fields belong to
6 matches
Mail list logo