[Django]-Coercing to Unicode: need string or buffer, int found – Django Rest Framework

8👍

✅

The problem is in the __unicode__ method of Doctor and Animal. You are returning the id which is a int, but this method excpects a str/buffer. Change it to:

def __unicode__(self):
    return str(self.id)

Leave a comment