Answers for ""must be called with either an object pk or a slug in the URLconf""

0

"must be called with either an object pk or a slug in the URLconf"

class HostDetailPageView(DetailView):
    template_name = 'hosts/hostdetail.html'
    model = Host
    pk_url_kwarg = 'name'

    def get_queryset(self):
        return super().get_queryset().filter(host__name=self.kwargs['host'])
Posted by: Guest on October-15-2020

Code answers related to ""must be called with either an object pk or a slug in the URLconf""

Python Answers by Framework

Browse Popular Code Answers by Language