Created
October 29, 2015 12:25
-
-
Save raphapassini/6e0c8d912c0d49c6e2c6 to your computer and use it in GitHub Desktop.
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
# models.py | |
class User(Document): | |
image = ImageField() | |
# views.py | |
image = open('/path/to/your/file', 'rb') | |
user = User() | |
user.image.put(image, content_type = 'image/jpeg') | |
user.save() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment