

def get_object(self, queryset=None):
    if (queryset is None):
        queryset = self.get_queryset()
    pk = self.kwargs.get(self.pk_url_kwarg, None)
    slug = self.kwargs.get(self.slug_url_kwarg, None)
    if (pk is not None):
        queryset = queryset.filter(pk=pk)
    elif (slug is not None):
        slug_field = self.get_slug_field()
        queryset = queryset.filter(**{
            slug_field: slug,
        })
    else:
        raise AttributeError(('Generic detail view %s must be called with either an object pk or a slug.' % self.__class__.__name__))
    try:
        obj = queryset.get()
    except ObjectDoesNotExist:
        try:
            queryset = self.get_queryset()
            queryset = queryset.filter(normalized_name=re.sub('[^A-Za-z0-9.]+', '-', slug).lower())
            obj = queryset.get()
        except ObjectDoesNotExist:
            raise Http404((_('No %(verbose_name)s found matching the query') % {
                'verbose_name': queryset.model._meta.verbose_name,
            }))
    return slug_field

dataset/ETHPy150Open crate-archive/crate-site/crateweb/apps/packages/simple/views.py PackageDetail.get_object/VarMisuse@236/335 `obj`->`slug_field`