2👍
✅
To check an M2M relation, you just do =
, not contains
:
Story.objects.filter(writers=request.user)
And you can use Q
objects to do an or
query:
Story.objects.filter(Q(wikiedit=True) | Q(writers=request.user))
Source:stackexchange.com