https://xxxx/category_check_view/?item_id=2
Above is a sample of URL pattern. How should i configured my URL in order to enable it to redirect to the right view? I seem to get it working for a url like this https://xxxx/category_check_view/2/ only so far.
You can pass parameters to a view either in the url:
Or via
GET
params:GET
params are not processed by the URL handler, but rather passed directly to theGET
param dict accessible in a view atrequest.GET
.The Django (i.e. preferred) way to do handle URLs is the first one. So you would have a URL conf:
And a matching view:
However, if you insist on passing the param via
GET
you would just do:And:
You can't use get parameters in URL pattern. Use them in your view: