which one error ?

 Look like error is related to  __str__ function  but I'm not sure (I'm
using python 2.7 )

Many thanks,

Serge


+380 636150445
skype: skhohlov


On Tue, Aug 19, 2014 at 6:09 PM, Andreas Kuhne <andreas.ku...@suitopia.com>
wrote:

> Hi all,
>
> I am having a problem with a time field in my mysql database. I can add
> values to the database, but when I try to read the values, I get the
> following error:
> Failed converting row to Python types; can't use a string pattern on a
> bytes-like object (field start_time)
>
> The database model looks like this:
> class AvailableTimeSetting(models.Model):
>     SETTINGS_CHOICES = (
>         (0, _('Monday')),
>         (1, _('Tuesday')),
>         (2, _('Wednesday')),
>         (3, _('Thursday')),
>         (4, _('Friday')),
>         (5, _('Saturday')),
>         (6, _('Sunday')),
>     )
>     store = models.ForeignKey('store.RetailStore')
>     weekday = models.IntegerField(_('Week day'),
>                                   max_length=1,
>                                   choices=SETTINGS_CHOICES)
>     start_time = models.TimeField(_('Start time'))
>     end_time = models.TimeField(_('End time'))
>     max_parallel_bookings = models.IntegerField()
>
>     class Meta:
>         app_label = 'timebooking'
>         verbose_name = 'Available time setting'
>         verbose_name_plural = 'Available time settings'
>
>     def __repr__(self):
>         return "<%s: %s>" % (self.__class__.__name__, self.__str__())
>
>     def __str__(self):
>         return "%s %s-%s %d" % (self.weekday, self.start_time,
> self.end_time, self.max_parallel_bookings)
>
>
> And the problem is on the start_time field. I see that the fields get
> saved correctly in the database. However as soon as I try to get an object
> I get the error.
>
> I am using mysql-connector-python version 1.2.2, and Python 3.4 in a
> django 1.6.4 project.
>
> Regards,
>
> Andréas
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CALXYUb%3DAk1GfO5bknfsMJ7cCYdFC0JACc3TXKb1cbFQHpFzppw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CALXYUb%3DAk1GfO5bknfsMJ7cCYdFC0JACc3TXKb1cbFQHpFzppw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADTRxJOU%3DtBKpwBFw_Afd73HBzu3vF5V%3DZy8NbHouFG20O_f1Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to