Home > database >  Couldn't pass parameter "smm" to the specified path
Couldn't pass parameter "smm" to the specified path

Time:04-17

<li><a href="{%url 'corebloc_app:service_type%} smm">Marketing & Management Services</a></li>

This is the HTML code, trying to pass the string "smm" to this:

path("services/<str:service_type>", views.service_type, name="service_type")

So that I could have a path "services/smm" on my address bar.

CodePudding user response:

The url template tag should be:

<li><a href="{%url 'corebloc_app:service_type' smm %}">Marketing & Management Services</a></li>

so you include the smm in the {% url … %} template tag [Django-doc]. If you want to use smm as string, you use:

<li><a href="{%url 'corebloc_app:service_type' 'smm' %}">Marketing & Management Services</a></li>
  • Related