Russ (and others), > The Django serializers accept any iterable, not just query sets. You > can pass in any list or set of Django object instances, and they > willserializefine. > > Yours, > Russ Magee %-)
I thought the same thing from this line in the serialization documentation: (Actually, the second argument can be any iterator that yields Django objects, but it'll almost always be a QuerySet). But this isn't working for me; please tell me what I'm doing wrong below. >>> >>> from django.core import serializers >>> serializers.serialize( "xml", ['abc','def','ghi'] ) Traceback (most recent call last): File "<console>", line 1, in ? File "/sw/lib/python2.4/site-packages/django/core/serializers/ __init__.py", line 67, in serialize s.serialize(queryset, **options) File "/sw/lib/python2.4/site-packages/django/core/serializers/ base.py", line 36, in serialize self.start_object(obj) File "/sw/lib/python2.4/site-packages/django/core/serializers/ xml_serializer.py", line 42, in start_object raise base.SerializationError("Non-model object (%s) encountered during serialization" % type(obj)) SerializationError: Non-model object (<type 'str'>) encountered during serialization >>> Now really, my goal is not to serialize a list, but rather a non-model object-instance. If I try passing in an instance of a class (in a list so it's iterable) that last error-line reads: SerializationError: Non-model object (<type 'instance'>) encountered during serialization If I try passing in (now in desperate curiosity-stage) the class itself (again, in a list) I get: SerializationError: Non-model object (<type 'classobj'>) encountered during serialization It seems to *really* want a model-object! Pointers very welcome! -Birkin --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---