[Fixed]-Django Muliple Variables in URL with database update

1👍

The issue is that \S+ matches all string characters, including “/”. So the regex '^(?P<blog_id>[0-9]+)/(?P<blog_slug>\S+)/?$ matches “1/my_blog/new_comment”, and your form ends up submitting to the show view rather than the add comment view.

Use \w+ instead to just match alphanumeric characters.

Leave a comment