On 12/15/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> def __str__(self):
> return str(self.id) + " [" + str(self.purchaser) + "] " +
> str(self.amount) + " (" + str(self.currentAmount) + ")"
I'm going to do some poking to see if I can replicate your actual
problem; in the meantime, though I'd like to suggest a minor
improvement to this __str__ method. Python lets you use printf-style
formatting in any string, so this could be written more clearly as:
def __str__(self):
return "%s [%s] %s (%s)" % (self.id, self.purchaser, self.amount,
self.currentAmount)
The %s operator will handle conversion of values to strings, saving
you lots of repetitive typing of str(this) and str(that).
--
"May the forces of evil become confused on the way to your house."
-- George Carlin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---