[Answered ]-Retrieve Class of ManyToManyField

2👍

The error message clearly points to the problem saying that the object you are returning has no attribute named “none”. This is probably what you want:

if animals:
  return animals.siblings.exclude(id=target_animal.id)
else
  cls_obj.siblings = []   
  return cls_obj.siblings

Leave a comment