On 2011-08-15, at 18:11 , Jacco77 wrote: > > How can I get django to understand that I want it to convert my > dictionary recursively? Then I want to full save it (the whole blob) > recursively, that is fields that are pointing to other models should > be saved first. The only piece of Django I can think of which would do that sort of things is the serialization framework.
While it does not (as far as I know) expose any interface to serializing objects as Python dicts and arrays, it does support serializing to JSON (although the structure is a bit more complex than what you show here as it stores the instance's model at a higher level of the structure than the raw field values), it should be a good start towards vivifying simple dicts into complete object structures. Therefore, I would recommend looking into serializers and how they're coded, and maybe just rework your dict structure a bit and add a new serializer to/from python dicts (I'm not sure how pluggable django's serializers are, but considering there's a SERIALIZATION_MODULES[0] settings key I'm guessing you can add pretty much anything you want, and some googling leads me to think it's even possible to replace the built-in serializers[1]). See also: http://readthedocs.org/docs/django-testing-docs/en/latest/serialization.html [0] https://docs.djangoproject.com/en/dev/ref/settings/#serialization-modules [1] http://pypi.python.org/pypi/wadofstuff-django-serializers -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

