django/django — pull request #1108 by patrys (2013-05-18 13:27:33+00:00)
Title: Make Model.__repr__() safe

`__repr__` is mainly used in the debugging context and it calling `__unicode__` can yield unwanted consequences such as executing a database query (I guess it's a common thing with translated objects).

This implementation also makes it easier to find the object in the database as it displays its primary key which is the only field we can assume to be indexed.

All tests pass.