This is my forms.py:
class UploadImageForm(forms.ModelForm):
class Meta:
model = UserImages
fields = [\'photo\']
and this i
there is super easier way,
in model:
def upload_thumb_dir(self, filename):
path = f'path_to_thumb.jpg'
return path
thumb = ProcessedImageField(upload_to=upload_thumb_dir,
processors=[ResizeToFill(192, 108)],
max_length= 255,
format='JPEG',
default='preview.jpg',
options={'quality': 80},
null=True, blank=True
)
# ...
def save(self, *args, **kwargs):
self.thumb = self.rawfile.file
super(VersionPreviews, self).save(*args, **kwargs)