Re: What is save to use in __repr__

2006-01-30 Thread Jan Rademaker
A bit of code would have clarified my problem. This is what I tried the first time: return "Testing %s %s %.2f" % (self.someForeignKey.someThing(), self.somedate.strftime("%d-%m-%Y"), self.someFloat) There were 2 problems, basically. First, I tried to access an object instance directly and not t

Re: What is save to use in __repr__

2006-01-30 Thread Adrian Holovaty
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_

Re: What is save to use in __repr__

2006-01-30 Thread Roberto Aguilar
I ran into the same thing in a model with a ForeignKey to an auth.User object. In my __repr__ function I had: self.get_user() which would crash Django. In this instance, I wanted the username specifically, so I resorted to using: self.get_user().username I didn't try, but I think this would

Re: What is save to use in __repr__

2006-01-30 Thread Maniac
Jan Rademaker 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 o