Generic detail view must be called with either an object pk or a slug

I would like to add that get_object could also be used in a case where we have a different look up parameter for primary key

Example, if I want to get my object by guid, which I am passing in my URLConf

def get_object(self):
    return Product.objects.get(guid=self.kwargs.get("guid"))

Set the slug_field attribute on the view class:

class ProductPage(DetailView):
    model = Product
    slug_field = 'product_slug'

Depending on your URLConf you may also need to specify the name of the kwarg that corresponds to the slug. It defaults to 'slug'. If you used something different in the URL specification, such as 'product_slug' in this example, specify the slug_url_kwarg property on the view as well:

    slug_url_kwarg = 'product_slug'
    # etc