title: Overriding get_queryset() in a Django DetailView
body: <p>I have two models, City and State with State being a ForeignKey relation of City.My CityDetailView url is constructed as:</p>
  
  <pre><code>r'^state/(?P&lt;state&gt;[-\w]+)/city/(?P&lt;slug&gt;[-\w]+)/$'
  </code></pre>
  
  <p>My CityDetailView called by the above url is:</p>
  
  <pre><code>class CityDetailView(DetailView):
      model = City
      context_object_name = 'city'
      template_name = 'location/city_detail.html'
  
      def get_queryset(self):
          state = get_object_or_404(State, slug__iexact=self.kwargs['state'])
          return City.objects.filter(state=state)
  
      def get_context_data(self, **kwargs):
          context = super(CityDetailView, self).get_context_data(**kwargs)
          city = City.objects.get(slug__iexact=self.kwargs['slug'])
          context['guide_list'] = Guide.objects.filter(location=city).annotate(Count('review'), Avg('review__rating'))
          return context
  </code></pre>
  
  <p>My City model has unique Names for each city. If I try and access a city that occurs in two states I get an error that the get() returned more than one City. I am trying to override the get_queryset() method to filter out only the City models in a single state but it does not seem to be working which is odd because my CityListView is similar but works fine. Any thoughts on what I am missing would be appreciated.</p>