I have a model Foo with an ImageField. I want to create new Foo
object from request.FILES and POST from inside a view function.
Ordinarily I would bind a form to request.FILES and request.POST to
get that data:
form = FooForm(request.FILES, request.POST)
But I cannot do that in this case (circumstances.)
I can do "manually" like this:
foo = Foo(
bar = request.POST.get('bar')
)
But not in the case of request.FILES
request.FILES['img'] is an InMemoryUploadedFile object:
<InMemoryUploadedFile: yanks.jpg (image/jpeg)>
How can I feed that to my model's ImageField?
I guess that what I'm basically asking is how can a person do:
>>>from mysite.myapp.models import Foo
>>>foo = Foo(bar = 'baz', img = <what?>)
>>>foo.save()
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---