﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
12483	Error message when Model.__unicode__() returns None	Luc Saffre	nobody	"I had already several times the situation that the __unicode__ method of one of my models returned None in some case. 
This leads to a ""TypeError: coercing to Unicode: need string or buffer, NoneType found"" traceback. 
That's okay, but sometimes it is not easy to guess *which* model is wrong. 
So I took django/db/models/base.py and added the lines marked '+' below:

{{{
    def __repr__(self):
        try:
            u = unicode(self)
        except (UnicodeEncodeError, UnicodeDecodeError):
            u = '[Bad Unicode data]'
    +   except TypeError,e:
    +       raise TypeError(""%s: %s"" % (self.__class__, e))
        return smart_str(u'<%s: %s>' % (self.__class__.__name__, u))
}}}


"	New feature	closed	Core (Other)	1.1	Normal	wontfix			Design decision needed	1	0	0	0	0	0
