Hey Sam you have missing imports.

Where do i get File(from)?
Also this uses a file which is on server.
How do i feed it a file which has been just uploaded.

Best regards,
Andrew




On Friday, June 5, 2015 at 6:56:47 AM UTC+8, Sam Kingston wrote:
>
> Hi Andrew,
>
> Try something like this (ripped from a shop I have written that syncs 
> images from another database):
>
> https://gist.github.com/sjkingo/b836272f0757b20f8016
>
> Hope this helps
>
> On Thursday, 4 June 2015 19:42:09 UTC+10, Andrew Fam wrote:
>>
>> I"m wondering how to create a new product image directly without the 
>> admin.
>>
>> Using a package that defines the following
>>
>> def upload_receive( request ): """ Returns the file(s) uploaded by the 
>> user. """ return request.FILES['files[]'] if request.FILES else None
>> I tried to create a Product image with the following which works in non 
>> cartridge fields,
>>
>> f = upload_receive(request)
>> instance = ProductImage.objects.create(file=f, product_id=2)
>>
>> I get *** TypeError: expected string or buffer
>>
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to