[Django]-Django filter that spans relationships but programmatically?

5👍

You can make a dictionary and unpack it into the keyword arguments:

filters = {'entry__headline__contains': 'Lennon'}
Blog.objects.filter(**filters)  

where entry__headline__contains can be dynamically evaluated.

👤alecxe

Leave a comment