mirror of
https://github.com/lemeow125/DRF_Template.git
synced 2025-08-02 17:23:16 +08:00
Convert image field to webp format
This commit is contained in:
parent
55f16b15fe
commit
2844f5d19a
2 changed files with 5 additions and 4 deletions
|
@ -15,8 +15,8 @@ class CustomUser(AbstractUser):
|
|||
# password inherited from base user class
|
||||
# is_admin inherited from base user class
|
||||
|
||||
avatar = models.ImageField(
|
||||
null=True, upload_to='avatars/')
|
||||
avatar = ResizedImageField(
|
||||
null=True, force_format="WEBP", quality=100, upload_to='avatars/')
|
||||
|
||||
def avatar_url(self):
|
||||
return f'/api/v1/media/avatars/{self.avatar.field.storage.name(self.avatar.path)}'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue