When I click on Customer name which has id=1. Then "customer() missing 1 required positional argument: 'id' this error has occurred.
This is my customer view:
'''
def customer(request,id):
customer=Customer.objects.get(pk=id)
order=customer.order_set.all()
return render(request,'accounts/customer.html',{'customer':customer, 'order':order})
'''
This is my URL.py:
'''
from django.urls import path
from . import views
urlpatterns = [
path('',views.home,name='home'),
path('customer/',views.customer,name='customer'),
path('product/int:id/',views.product,name='product'),
]
'''
Top comments (4)
Hey there!
Just wanted to let you know that the #help tag would work well here if you're asking a question.
Thanks for reply.
I have added help tag.
You mean remove the I'd ??
after removing id tag following error occurred:
"customer() missing 1 required positional argument: 'id'"