[Fixed]-Django, ManyToMany, checking the value

1👍

You are trying to compare the content of an object, with the object itself.

a.the_courses.all() returns a queryset (like a list of objects).

An alternate way of testing what you are looking for is:

if a.the_courses.filter(abbreviation="MSIT").exists():
    print "Success"

Leave a comment