Oh, I should have seen that coming. (That's the bad thing when you write code without testing it yourself... something is often missed :-)
This should fix the error you got: import StringIO from django.core.files import File f = StringIO.StringIO() f.name, f.mode = 'data.xml', 'r' f.write(data) myfile = File(f) Chart.objects.create(xml=default_storage.save(f.name, myfile)) However, Marty's solution seems a lot nicer. Did that not work? I've never done anything like what I've shown you - it was more or less a straight guess as to how it might work. Marty's solution looks a lot more correct and a lot cleaner too. Perhaps you should be trying to make that work instead? Tim ^,^ On Thu, Aug 28, 2008 at 7:18 PM, julianb <[EMAIL PROTECTED]> wrote: > > On Aug 28, 6:03 pm, "Tim Kersten" <[EMAIL PROTECTED]> wrote: >> There's probably a better way than this though so you might want to >> wait for other replies. >> >> import StringIO >> from django.core.files import File >> f = StringIO.StringIO() >> f.write(data) >> myfile = File(f) >> Chart.objects.create(xml=default_storage.save('data.xml', myfile)) > > That's not working for me, I get AttributeError: StringIO instance has > no attribute 'name'... > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---