Hello Wai,
Thank you so much for your help. You are right the view had to be
rewritten. My problem, however is still at the template. For some
reason the template code and the URL code aren't coming together
producing the
error message:
commodity() takes exactly 2 arguments (1 given)
Thanks a
You should rewite the method:
def commodity(request, commodity_id):
p = get_object_or_404(Commodity, pk=commodity_id)
return render_to_response('fsafety/commodity_detail.html',
{'commodity': p})
to
def commodity(request):
commodity_id = request.POST['commodity'] # this variable com
Hello All,
Thank you for the suggestions. I am getting closer to figuring it
out. Now my error is this:
commodity() takes exactly 2 arguments (1 given)
My URL is:
(r'^commodity/$', 'commodity'),
The Form statement:
Thank you!
May
On Jan 13, 10:56 am, Wai Yi Leung wrote:
> Hi May,
>
Hi May,
Try to debug in shell, this will give you more information.
Lets print the 'p' value after having it set with get_object_or_404 ...
And I think you are a bit messing with which method to call. You are
generating the page with the form that contains errors. So lets check
your index() me
2009/1/14 May :
>
> Hello,
>
> I tried the URL and still received this error:
> Page not found (404)
> Request Method: POST
> Request URL:http://127.0.0.1:8000/fsafety//commodity_detail/
Yep... sorry i just checked for the url didnt read the form part in detail :p
> I think now that
Hello,
I tried the URL and still received this error:
Page not found (404)
Request Method: POST
Request URL:http://127.0.0.1:8000/fsafety//commodity_detail/
I think now that the ID is not getting passed to this line:
Thank you for any help you can give.
May
On Jan 13, 10:25 am, S
replace in your url.py:
(r'^(?P\d+)$/commodity_detail/', 'commodity'),
by
(r'^(?P\d+)/commodity_detail/$', 'commodity'),
this _should_ work
2009/1/14 May :
>
> My error is not being able to get the ID passed to the next
> template.
>
> The code:
>
> http://dpaste.com/108580/
>
> Thank you,
>
My error is not being able to get the ID passed to the next
template.
The code:
http://dpaste.com/108580/
Thank you,
May
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this gr
8 matches
Mail list logo