[Fixed]-Searching objects in django

1👍

exact and contains are quite different. We could say exact is a subset of contains.

Your title field could contain 'Django', but the title itself isn’t 'Django', so exact or iexact fails.

e.g.

title = 'Django: the framework for perfectionists with deadlines'

Works for contains but fails for [i]exact.

If you’re looking for case-insentive containment, then icontains is what you want.

Leave a comment