Reputation: 15
I'm getting this error, in admin panel other than this the website is working fine.
These are in views.py
And this is for new user registration
I think the error is happening because the order model is receiving a NoneType customer as a foreign key. But I don't know how to solve this problem. I'm new to django please help me out.
Upvotes: 0
Views: 709
Reputation: 2165
you can do it like this:
def __str__(self):
if self.name:
return self.name
else:
return self.email
you have to return at least something
Upvotes: 2