Last active
December 13, 2015 17:19
-
-
Save alexlovelltroy/4947208 to your computer and use it in GitHub Desktop.
fixed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage' | |
image_request = requests.get(url) | |
content_type=image_request.headers['content-type'] | |
filename = 'blarg' | |
if content_type == 'image/jpeg': | |
filename = "blarg.jpg" | |
if content_type == 'image/png': | |
filename = "blarg.png" | |
image_file = SimpleUploadedFile( | |
filename, | |
image_request.content, | |
content_type=content_type | |
) | |
print image_file.__dict__ | |
avtr.avatar.save(image_file.name, image_file) # avtr.avatar is an ImageField | |
avtr.save() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment