[Django]-Django form action "." reloads same page with missing slug

4👍

You didn’t show your URL patterns, but they should all end with /. So the original URL of http://localhost:8000/blog/2019/5/2/second-post should be http://localhost:8000/blog/2019/5/2/second-post/. For example, the pattern might be:

path('blog/<int:year>/<int:month>/<int:day>/<slug:slug>/', views.blog, 'blog'),

which ends with a slash and so the generated path will also end with a slash. Then posting to “.” will work properly.

Leave a comment