(self, instance, flag='')
return queryset
Filter to a specific instance.
Filter to a specific instance.
Filter to a specific instance .
def for_object(self, instance, flag=''):
        """
        Filter to a specific instance.
        """
        check(instance)
        content_type = ContentType.objects.get_for_model(instance).pk
        queryset = self.filter(content_type=content_type, object_id=instance.pk)
        if flag:
            queryset = queryset.filter(flag=flag)
        return queryset
def for_object ( self , instance , flag = '' ) : check ( instance ) content_type = ContentType . objects . get_for_model ( instance ) . pk queryset = self . filter ( content_type = content_type , object_id = instance . pk ) if flag : queryset = queryset . filter ( flag = flag ) return queryset