On Fri, Dec 11, 2009 at 6:25 PM, Andy wrote:
> Tom - DR's method is simple and effective, but I'm guessing you say
> it's the worst way because it creates an unnecessary database
> request. Is this a correct assumption? If not, please explain.
>
>
There are at least 2
Why wouldn't you fetch the latest (completed) order by that particular user
from the db? No id passing around, and it should give you only one result.
If you pass an id, and don't use the session, make sure the order belongs to
the user, otherwise users could see other users orders based on id
Tom - DR's method is simple and effective, but I'm guessing you say
it's the worst way because it creates an unnecessary database
request. Is this a correct assumption? If not, please explain.
On Dec 11, 10:58 am, Tom Evans wrote:
> On Fri, Dec 11, 2009 at 4:44 PM,
On Fri, Dec 11, 2009 at 4:44 PM, Andy wrote:
> Thank you DR. For other newbies out there I changed my views to this
> and it worked great:
>
> articles = Context({'articles': Articles.objects.all()})
>
> def order(request):
> if request.method == 'POST':
>
Thank you DR. For other newbies out there I changed my views to this
and it worked great:
articles = Context({'articles': Articles.objects.all()})
def order(request):
if request.method == 'POST':
form = OrderForm(request.POST)
if form.is_valid():
On Fri, Dec 11, 2009 at 3:13 PM, Andy wrote:
> Thanks for the response Shawn. I have done what you suggested,
> assigning a variable named order_info and can use it if I use
> render_to_response in my order view. But I want to use
> HttpResponseRedirect after the form is
On Dec 11, 3:13 pm, Andy wrote:
> Thanks for the response Shawn. I have done what you suggested,
> assigning a variable named order_info and can use it if I use
> render_to_response in my order view. But I want to use
> HttpResponseRedirect after the form is saved. I'm
Thanks for the response Shawn. I have done what you suggested,
assigning a variable named order_info and can use it if I use
render_to_response in my order view. But I want to use
HttpResponseRedirect after the form is saved. I'm thinking I need to
get the order_info variable into my
If you assign the output of the save() method, you'll get the created object.
Instead of:
form.save()
do:
current_order = form.save()
Then you can do whatever you like with current_order, which will be an instance
of whatever the class 'meta' is of your OrderForm, assuming that OrderForm is
This is a very beginner question:
Say a user has just filled out a form and hit the submit button. They
are redirected to an order confirmation page. How can I retrieve the
one row of data the user just submitted and display it on the order
confirmation page?
Here is my simple View so far, but
10 matches
Mail list logo