def django_file(path, field_name, content_type):
# adapted from here:
# http://groups.google.com/group/django-users/browse_thread/thread/
# 834f988876ff3c45/
f = open(path)
return InMemoryUploadedFile(
file=f,
field_name=field_name,
name=f.name,
content_type=content_type,
size=os.path.getsize(path),
charset=None
)
评论列表
文章目录