Finally, something I do know about because I struggled with the same
problem!
> (1) My model includes an Event class. Events should be displayed
> using the date as their name. So the name of the event might be
> "August 25th, 2006". But if I add a def(self): __str__(self.date) to
> the class, I get an error "__str__ returned non-string (type
> datetime.date)" -- how can I make it a pleasantly formatted date string?
def __str__(self):
return self.date.strftime("%b %d %Y")
You can see the reference for the time module (
http://docs.python.org/lib/module-time.html ) to get all the formatting
codes for stftime().
I'll try to see if I figure out the rest, as I have run into similar
problems (especially wrt the 24 hour clock thing).
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---