class MyModel(models.Model):
# file will be uploaded to MEDIA_ROOT/uploads
upload = models.FileField(upload_to='uploads/')
# or...
# file will be saved to MEDIA_ROOT/uploads/2015/01/30
upload = models.FileField(upload_to='uploads/%Y/%m/%d/')
Last active
July 14, 2016 13:31
-
-
Save LeoHeo/fee32025eac1a11adfec87a90f427295 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
class MyModel(models.Model): | |
# file will be uploaded to MEDIA_ROOT/uploads | |
upload = models.FileField(upload_to='uploads/') | |
# or... | |
# file will be saved to MEDIA_ROOT/uploads/2015/01/30 | |
upload = models.FileField(upload_to='uploads/%Y/%m/%d/') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment