On Aug 28, 8:44 pm, "Tim Kersten" <[EMAIL PROTECTED]> wrote:
> 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?

AttributeError: StringIO instance has no attribute 'name'

I tried several things, I think Marty's solution was among them. It
did not throw errors, but the file I got was 0 bytes. I will try again
and check if I made a mistake or so...
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to