TypeError: __str__ returned non-string (type PhoneNumber)
Published on 19 August 2022 11:00 AM
Django error - TypeError: str returned non-string (type PhoneNumber)
Error:
TypeError: __str__ returned non-string (type PhoneNumber)
Solution:
In the model.py file add the following code:
def __str__(self):
return str(self.phone_number)
Pypi Package: django-phonenumber-field
Resource:
https://github.com/stefanfoulis/django-phonenumber-field
https://stackoverflow.com/questions/41288844/typeerror-str-returned-non-string-type-phonenumber