Reputation: 55
I write a django app,but there is error troubling me. this is the code from my model:
class Orders(models.Model):
checkin = models.DateField()
checkout = models.DateField()
total = models.FloatField()
client = models.ForeignKey(Client)
def __unicode__(self):
return self.checkin
last, I add a record with Django administration,and submit, it return an error: http://dpaste.com/1202450/ thanks.
Upvotes: 1
Views: 62
Reputation: 599490
Your __unicode__
method must return a unicode string, not a date. You should convert the field:
def __unicode__(self):
return unicode(self.checkin)
You may want to convert the date to a specific human-readable format instead, using strftime
.
Upvotes: 3