+ if ignore_by_tag is not None:
+ query += """
+ AND NOT EXISTS (
+ SELECT * FROM %(tagged_item)s
+ WHERE %(tagged_item)s.object_id = %(model_pk)s
+ AND %(tagged_item)s.content_type_id = %(content_type_id)s
+ AND %(ignore_id)s = %(tagged_item)s.tag_id
+ )
+ """