[Answer]-Django filter ManyToMany relationship from a single object

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

Leave a comment