Django url pattern regex to pass a email as a parameter in the url

后端 未结 2 1785
甜味超标
甜味超标 2021-02-16 00:21

I am writing a view which is accepting a email as parameter passed by url like

url(r\'^admin/detail_consultant_service/((?P\\[A-Z0-9._%+-]+         


        
2条回答
  •  余生分开走
    2021-02-16 00:59

    If you have more than one application in a project, which is most likely the case here, your url should be namespaced. The url in the template should be in this format as explained Here

    {% url 'My-App-Name:my-url-name' args or kwargs %}
    

    Hence your code shoul look like this,

    {% url 'Your-app-Name:consultant_service_detail' consultant_id=consultant.id %}
    

提交回复
热议问题