On 1/30/06, Jan Rademaker <[EMAIL PROTECTED]> wrote: > What is save to use __repr__ ? > > I've found out that I shoud use self.get_someForeignKey().someThing() > instead of self.someForeignKey.someThing(), but what about date fields > and such? > > Because, when I use self.someDateField in __repr__ django crashes the > moment _add_ a new object (using admin).
This isn't a Django problem; it's a basic Python rule that any __repr__() method must return a string. For that reason, you should make sure that __repr__() returns a string, not an object instance or (in the case of date fields) a datetime object. Adrian -- Adrian Holovaty holovaty.com | djangoproject.com | chicagocrime.org