Hello. I am trying to make this system work:
Restaurant/views.py: class SearchRestaurantListView(ListView): # template_name = 'restaurants/restaurantlocation_list.html' def get_queryset(self): print(self.kwargs) slug = self.kwargs.get("slug") if slug: print("working") queryset = RestaurantLocation.objects.filter( Q(category__iexact=slug) | Q(category__icontains=slug) ) else: queryset = RestaurantLocation.objects.all() return queryset urls.py: path('restaurants/<slug:slug>/', SearchRestaurantListView.as_view()) When the slug field is empty the debugger states it couldn't find 'restaurants/', the statement above should work no? Appearently not. Please help -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9671ccb3-51e6-41d0-b461-7def9dc2425f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.