[Answer]-How Do I Fetch Article that has #exam and NOT #example in Django?

1👍

An ugly (but simple) hack would be to look for ‘#exam ‘ (note the whitespace) instead. Of course, this instantly breaks as soon as there’s some other character there instead.

A more elegant solution would be to craft a regex query that would match against #exam but not #example. However, see the regex field lookup entry in the Django documentation first, because the exact expression to pass will vary.

Leave a comment