1👍
✅
The result of get()
is a model instance, not a QuerySet
, so you can’t filter on it. Instead:
if defob.student_def.filter(id=u.id).exists():
# do things
Source:stackexchange.com