def queryset(self, request, queryset):
        try:
            value = int(self.value())
        except __HOLE__:
            value = None
        if value:
            # ensure the content type is allowed
            for choice_value, _ in self.lookup_choices:
                if choice_value == value:
                    return queryset.filter(polymorphic_ctype_id=choice_value)
            raise PermissionDenied(
                'Invalid ContentType "{0}". It must be registered as child model.'.format(value))
        return queryset
dataset/ETHPy150Open chrisglass/django_polymorphic/polymorphic/admin.py/PolymorphicChildModelFilter.queryset