title: Django how to make flexible generic views
body: <p>How do you make flexible generic views?</p>
  
  <p>At the moment I have two models one for apples and one for pears, and a single template I want to use.</p>
  
  <pre><code>from django.views import generic
  
  class AppleIndexView(generic.ListView):
     template_name = 'fruit/index.html'
     context_object_name = 'apple_list'
  
     def get_queryset(self):
       return Apple.objects.values()
  
  class PearIndexView(generic.ListView):
     template_name = 'fruit/index.html'
     context_object_name = 'pear_list'
  
     def get_queryset(self):
       return Pear.objects.values()
  </code></pre>
  
  <p>Is there a way of being more DRY? There should be a better way.</p>
  
  <p>Thank you for your time</p>
  
  <p><strong>EDIT ADDITIONAL REQUEST</strong></p>
  
  <p>Can someone write out this example out as a unified view, could it's unbound to one model. So I can see it as it should be.</p>