[Django]-TypeError: 'datetime.date' object has no attribute '__getitem__'

6👍

Your __unicode__ methods need to return a Unicode string, not a datetime.date object. So you should adapt the following to return Unicode:

def __unicode__(self):
    return self.data_pedido

For example:

def __unicode__(self):
    return unicode(self.data_pedido)

Or you can format the date using a formatting method.

Leave a comment