Thank you a lot for this snippet!
I've wondered about how to export objects to excel in a "more natural way"
and this seems to be a great approach, considering all the different
gotchas.
Thank you for taking the time to write this.. I've been postponing this
little bit of research for the longest
Thank you for the suggestion.
I actually ended up extending Django's json serializer. Here is the
code in case you or someone else needs to do something like this.
from django.core.serializers.json import Serializer as JsonSerializer
from django.utils.encoding import is_protected_type
class Displ
> The response is something like:
> 'Content-Type: text/html; charset=utf-8\n\n[{"pk": 1, "model":
> "MyApp.foo", "fields": {"choice_field": "db_name1"}}]'
This is interesting.. But I think the serializer is working properly.
the first element in the tuple is the value stored in the database,
and
Hello,
I'm new to Django and having a problem with serialization.
I am trying to serialize a model that has a CharField with choices,
and the json serializer returns json with the choices' database values
instead of display values.
Is there a way to get the json serializer to use the choices's di
4 matches
Mail list logo