Tuesday, August 4, 2020

Re: NoReverseMatch

In createOrder function in views.py 
u need to pass pk as well 

createOrder(request,pk)

On Wed, Aug 5, 2020, 2:11 AM Haris Ahmad <xhadow43@gmail.com> wrote:
Hello everyone, I'm getting this error,
Reverse for 'create_order' with no arguments not found. 1 pattern(s) tried: ['create_order/(?P<pk>[^/]+)/$']  

I'm getting this error when I use
path('create_order/<str:pk>/', views.createOrder, name="create_order"),

but there is no such error when path is..

path('create_order', views.createOrder, name="create_order"),

urls.py

  1. from django.urls import path
  2.  from . import views
  3.  urlpatterns = [ 
  4.  path('', views.home, name="home"),
  5. path('products/', views.products, name='products'),

  6. path('customer/<str:pk_test>/', views.customer, name="customer"), path('create_order/<str:pk>/', views.createOrder, name="create_order"), path('update_order/<str:pk>/', views.updateOrder, name="update_order"), path('delete_order/<str:pk>/', views.deleteOrder, name="delete_order"), 
  7.    ]

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e523abbe-b2dd-4935-b051-e56b310137ddn%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAC21hZK5ZDKODizeNRWcxLP6Ont-bJ-iARYGqeFSq14sXZ03dw%40mail.gmail.com.

No comments:

Post a Comment