I'm new to Django. I keep getting a 404 error when I try to pass a "prod" parameter to a url. I think it is just this last parameter that is giving me trouble.
(r'^order_closeouts/(?P<foo>\w{4})/(?P<prod>)w+/$', 'onhand.views.order_closeouts', ),
def order_closeouts(request, foo=None, prod=None):
prod=prod
ok='notok'
message1=''
u=request.user.username
custs=Cust.objects.all()
c_num=User.objects.get(username=u)
custnum=c_num.first_name
if not custnum or custnum=='':
return HttpResponseRedirect('/denied/')
cus=custnum
for i in custs:
if custnum in i.custno:
ok='ok'
if ok !='ok':
return HttpResponseRedirect('/denied/')
search_i=SearchForm()
form=InvtForm2()
forms=CustForm()
forms_mast=SoMastForm()
forms_tran=SoTranForm()
#use date
day=date.today()
today=day.isoformat()
if foo=='nchg':
message1='You did not order any products yet. Please proceed below.'
if foo=='chgs':
message1='Your changes were successful! Please continue.'
if foo=='edit':
customers=SomastTemp.objects.get(custno=request.user.first_name)
else:
customers=Cust.objects.get(custno=request.user.first_name)
return render_to_response('order_closeouts.html', {'prod':prod, 'foo':foo,'search':search_i,'form':form,'forms':forms, 'today': today, 'user':cus, 'forms_mast':forms_mast, 'forms_tran':forms_tran, 'customers':customers, 'message':message1}, context_instance = RequestContext(request))
Any help or suggestions would be very much appreciated. Thanks!