I have two snap of code below. I want to know that in the first one I used template_name='restaurants/restaurants_list.html' which is obvious if I want to use a template but in the second one I have not specified the template name even then it shows the correct web page.How?
class RestaurantListView(ListView):
template_name='restaurants/restaurants_list.html'
def get_queryset(self):
slug=self.kwargs.get("slug")
if slug:
queryset=RestaurantLocation.objects.filter(
Q(category__iexact=slug)|
Q(category__icontains=slug)
)
else:
queryset=RestaurantLocation.objects.all()
return queryset
##########################################################
class RestaurantListView(ListView):
def get_queryset(self):
return RestaurantLocation.objects.all(owner=self.request.user)