I'm setting up a simple timecard app as a django proof-of-concept.
One of my models is "Period" that specifies the end-date of the time
period (usually a Friday).

I'm not getting __repr__ right.

Trying to add a period in the admin side:

TypeError at /admin/timekeeper/period/add/
__str__ returned non-string (type datetime.date)Request Method: POST
Request URL:    http://localhost:8000/admin/timekeeper/period/add/
Exception Type: TypeError
Exception Value:        __str__ returned non-string (type datetime.date)
Exception Location:     
c:\python25\lib\site-packages\django\contrib\admin\views\main.py
in add_stage, line 256

The model:
class Period(models.Model):
    end_date = models.DateField('end date')
    insert_date = models.DateTimeField('date inserted', auto_now_add=True)

    def __str__(self):
        return self.end_date

    class Admin:
        pass

Is there an easy way to munge the return self.end_date into a string?

Thanks for the help.

-- 
Andrew Diederich

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to