How can I use django.core.files.File

Posted by Jake on Stack Overflow See other posts from Stack Overflow or by Jake
Published on 2010-04-16T01:41:55Z Indexed on 2010/04/16 1:53 UTC
Read the original article Hit count: 610

Filed under:

The docs for django.core.files.File imply I can do this: print File(open(path)).url but the File object has no attribute 'url' However, django.db.models.fields.files.FieldFile extends File and does have all the attributes described in the docs for File, but I can't create one without giving it a model field.
All I want it something that does what the docs for django.core.files.File (link above) say it does, take a python file and give it attributes like 'url' and 'path' and 'name', can anyone help?

Cheers, Jake

© Stack Overflow or respective owner

Related posts about django