100% correct!
Your Assignments.__str__
method as defined above is:
def __str__(self):
if self.assignment:
if self.assignment == 'selectChanged':
return 'lastAssignmentSelected'
else:
return "err"
In this specific case, if the first if
is false (if self.assignment:
), this function will return None instead of a string. (The else: return "err"
clause only applies to the inner if
, if self.assignment == "selectChanged"
.)
So now at this point, your JavaScript in your page should be able to make a valid request, and get a valid response from your view. Is it doing that?