1👍
✅
try this:
class SugboxDetailView(generic.DetailView):
model = Box
template_name = "boxes/details.html"
context_object_name = "sugbox"
pk_url_kwarg = 'id'
def get_queryset(self):
qs = super(SugboxDetailView, self).get_queryset()
return qs.filter(...., attr=self.kwargs.get('id'))
Source:stackexchange.com