Skip to content

Instantly share code, notes, and snippets.

@mociepka
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mociepka/9230289 to your computer and use it in GitHub Desktop.
Save mociepka/9230289 to your computer and use it in GitHub Desktop.
picture = product.picture
picture = UploadedFile(
picture.file, name=path.split(picture.name)[1], size=picture.size, content_type='image/png')
image = Image.objects.create(file=picture, folder=folder)
product.image = image
product.save(update_fields=['image'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment