def get_object(self, **kwargs):
        if self.path_field not in self.kwargs:
            raise AttributeError("Category detail view %s must be called with "
                                 "a %s." % self.__class__.__name__, self.path_field)
        if self.queryset is None:
            queryset = self.get_queryset()
        try:
            return get_category_for_path(self.kwargs[self.path_field], self.model.objects.all())
        except ObjectDoesNotExist:
            raise Http404(_("No %(verbose_name)s found matching the query") %
                          {'verbose_name': queryset.model._meta.verbose_name})
dataset/ETHPy150Open callowayproject/django-categories/categories/views.py/CategoryDetailView.get_object/original