[Answered ]-How send value from view to template form url

1👍

Inside the url tag, or any other built-in template tag and filter for that matter, you don’t need to declare the ‘django variable’ with extra {{ }}.
You just have to use the default x. the way you declare it in your context, so it should be:

action="{% url 'chat:login-bot' x %}"

Note: Always add / at the end of every route, so:

path('log/<x>/', csrf_exempt(views.login), name='login-bot')

If nothing is specified in url params, so by default that is considered string type.

For e.g. "log/<x>/" and "log/<str:x>/" is same.

👤haduki

Leave a comment