The current path, search_shop/5ka/, didn't match any of these. Django

mascai

I have an error:

The current path, search_shop/5ka/, didn't match any of these.

Reason of the problem is name of the slug field 5ka. When I changed name from 5ka to pka it works fine.

How can I use 5ka without errors?

models.py

class Shop(models.Model):
    title = models.CharField(max_length=200)
    image = models.ImageField(blank=True)
    slug = models.SlugField(null=False, default="Shop") # I mean this field

def get_search_url(self):
    return reverse('search_shop', kwargs={'slug': self.slug})

urls.py

urlpatterns = [
    path('', HomePageView.as_view(), name='main_list'),
    path('search/', SearchResultsView.as_view(), name='search_results'),
    path('search_shop/<slug:slug>', ProductListView.as_view(), name='search_shop'),
    path('search_shop_results/<slug:slug>/', ProductSearchResultsView.as_view(), name='search_shop_results'),
    path('<slug:slug>/<int:pk>/', views.product_detail, name='product_detail'),

    path('shops/', ShopListView.as_view(), name='shop_list'),
]

shop_list.html

{% for shop in shops %}   
    <a href="{{ shop.get_search_url }}"
Pavan kumar

just include a / in the following line it will be resolved

path('search_shop/<slug:slug>/', ProductListView.as_view(), name='search_shop'),

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

The current path, imageupload, didn't match any of these, Page not Found Django

Django The current path, newapp/1, didn’t match any of these

Current path didn't match any of these

The current path, didn't match any of these

The current path,didn't match any of these

Error The current path, didn't match any of these

The current path, **/POST, didn’t match any of these

Django - The current URL, , didn't match any of these

Django - The current url didn’t match any of the these

django URLconf current path didn't match

The empty path didn't match any of these (django)

django The current path, image/25x25, didn't match any of these

default data type of primary keys in models (django), The current path, url '/app' didn't match any of these

The current path, accounts/home.html, didn't match any of these

The current path, account/login/, didn't match any of these?

Ajax url with parameter. The current path didn’t match any of these

The current path, imgupload/imageprocess, didn't match any of these

Django 1.10: The current URL didn't match any of these

Current path didn't match the url patterns - Django

Page not found 404 Django The current path , didn’t match

django url pattern "The empty path didn't match any of these."

Django routing - The empty path didn't match any of these

Plotly Dash Integration with Django : The current path, welcome.html, didn’t match any of these While Applying Navigation on Sidebar

The current URL, app/, didn't match any of these

The empty path didn't match any of these

The empty path didn't match any of these:

The empty path didn’t match any of these

my code keeps showing me this error 404: the current path,get, didn't match any of these

Page not found (404) The current path, register/register, didn’t match any of these