Django Views which one should I follow? [closed]

I'm new to Django framework I'm confused about the difference in which one I should follow use.

Many developers use "django.views import View" and some are using "django.views.generic import ListView ..."

which one is optimized in both of them? I know their output are the same but which one should I follow?

from django.views import View
....
class HomePage(View):
    def get(self, request):
       posts = Post.object.all().order_by('created')
       context = {'posts':posts}
       return render(request, 'html/homepage.html', context)       

or this one

class HomePage(ListView):
    model = Post
    template_name = 'html/homepage.html'
    context_object_name = 'posts'
    ordering = ['created']
    paginate_by = 3
Back to Top