File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -104,7 +104,9 @@ Utils
104104 UploadToAutoSlugClassNameDir
105105
106106
107- class MyClass(models.Model)
107+ class MyClass(models.Model):
108+ title = models.CharField(max_length=50)
109+
108110 # Gets saved to MEDIA_ROOT/myclass/#FILENAME#.#EXT#
109111 image1 = StdImageField(upload_to=UploadToClassNameDir())
110112
@@ -118,10 +120,10 @@ Utils
118120 image4 = StdImageField(upload_to=UploadToClassNameDirUUID())
119121
120122 # Gets save to MEDIA_ROOT/images/#SLUG#.#EXT#
121- image5 = StdImageField(upload_to=UploadToAutoSlug(path='images ))
123+ image5 = StdImageField(upload_to=UploadToAutoSlug(populate_from='title' ))
122124
123125 # Gets save to MEDIA_ROOT/myclass/#SLUG#.#EXT#
124- image6 = StdImageField(upload_to=UploadToAutoSlugClassNameDir())
126+ image6 = StdImageField(upload_to=UploadToAutoSlugClassNameDir(populate_from='title' ))
125127
126128 Validators
127129 The `StdImageField ` doesn't implement any size validation. Validation can be specified using the validator attribute
You can’t perform that action at this time.
0 commit comments