Error in admin: __str__ returned non-string (type NoneType)

Turns out that there was an unexpected empty CharField in a related model. Leaving this an an answer, because it might help others.

Troubleshoot the issue by systematically commenting out the __str__() methods of your models until you find the offending model. Work from there to identify the offending record(s).


I had a similar issue. The problem was that the primary key for one row was null ( I dont know how that happened). I couldnt delete the row because of cascade issues. so I had to change the str mmethod to somthing like this.

def __str__(self):
    if self.customerName==None:
        return "ERROR-CUSTOMER NAME IS NULL"
    return self.customerName