filter a queryset by containing a string

You can use .annotate(…) [Django-doc] to inject the text of the article, and then filter the objects:

from django.db.models import F, Q, TextField, Value

    article_text=Value(article.text, output_field=TextField())
    Q(substring=None) |
    Q(substring='') |

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top