Django __str__ returned non-string (type NoneType)

you can try:

def __str__(self):
    return str(self.ProductName) if self.ProductName else ''

Leave a Comment