This is my model:
class Meeting(models.Model):
start_time = models.TimeField(null=True)
def __unicode__(self):
return u'%s' % (str(self.start_time))
When I do Meeting.objects.all()
I get
TypeError: not all arguments converted during string formatting
Hopefully this is an easy question! Thanks a lot :)
The TimeField stores time in a python datetime instance. From the django docs:
class TimeField(auto_now=False, auto_now_add=False, **options)
A time, represented in Python by a datetime.time instance.
You should be able to print the datetime object directly to the console, but if you need to convert it to a string, you should always use python's built in time
framework. Specifically, strftime()