El 03/06/17 a les 16:27, Simon Charette ha escrit:
> Hello Alexis,
>
> As you've noticed Django 1.8 changed values()/values_list() to
> converts values returned
> from the database just like any other ORM method[0].
>
> If you want to use the json module to serialize your horari.Horari
> instances you'll have
> to define your own JSONEncoder (or DjangoJSONEncoder) subclass.
>
> class ToStrJSONEncoder(DjangoJSONEncoder):
> def default(o):
> if hasattr(o, 'to_str'):
> return o.to_str()
> return super().default(o)
>
> Cheers,
> Simon
>
> [0] https://docs.djangoproject.com/en/1.8/releases/1.8/#subfieldbase
Thank you Simon!
I've missed this change. I should spend some time rereading the changelogs.
Regards
--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c71bfdd0-2c78-9f7c-0f72-a6f0608af31f%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment