Q: How Django view's decide which html page to render/display? In my View i have not mentions template_name then how django will decide which html page to render during request?
Here is my views.py :
from django.shortcuts import render


from django.views.generic import ListView, DetailView
from . models import Movie

class MovieList(ListView):
    model = Movie

   # template_name = 'movie_list.html'
class MovieDetail(DetailView):
    model = Movie
    #template_name = 'movie_detail.html'

As shown in code i haven't mention any template_name then how django know page location?
when i use url "http://localhost:8000/movies/" it display's MovieList.html

A: from django.shortcuts import render


from django.views.generic import ListView, DetailView
from . models import Movie

class MovieList(ListView):
    model = Movie

   # template_name = 'movie_list.html'
class MovieDetail(DetailView):
    model = Movie
    #template_name = 'movie_detail.html'

Taking your example - 
Example: if model name is Movie


*

*for ListView:  movie_list.html

*for DetailView: movie_detail.html

*for DeleteView: movie_confirm_delete.html

*for CreateView & UpdateView: movie_form.html
As you can see it takes the model name  in lowercase and adds the view type after the underscore. You can experiment it by  running the application without the templates and then it will raise the DoesNotExist error saying it couldn't find movie_list.html if you haven't made it already in template folder. For all CBV's you'll see the name of html django wants.

A: By default Django generate template_name using your model name and some suffix/prefix.
For instance, for a ListView, the template_name is generated in the MultipleObjectTemplateResponseMixin object. In your case:


*

*MovieList: movie_list.html

*MovieDetail: movie_detail.html
