@@ -30,6 +30,7 @@ and are ready to adopt in your project :)
3030from django.db import models
3131from pictures.models import PictureField
3232
33+
3334class Profile (models .Model ):
3435 title = models.CharField(max_length = 255 )
3536 picture = PictureField(upload_to = " avatars" )
@@ -77,7 +78,7 @@ python3 -m pip install django-pictures
7778# settings.py
7879INSTALLED_APPS = [
7980 # ...
80- ' pictures' ,
81+ " pictures" ,
8182]
8283
8384# the following are defaults, but you can override them
@@ -96,7 +97,6 @@ PICTURES = {
9697 " USE_PLACEHOLDERS" : True ,
9798 " QUEUE_NAME" : " pictures" ,
9899 " PROCESSOR" : " pictures.tasks.process_picture" ,
99-
100100}
101101```
102102
@@ -155,8 +155,8 @@ from pictures.models import PictureField
155155class Profile (models .Model ):
156156 title = models.CharField(max_length = 255 )
157157 picture = PictureField(
158- upload_to = " avatars" ,
159- aspect_ratios = [None , " 1/1" , " 3/2" , " 16/9" ],
158+ upload_to = " avatars" ,
159+ aspect_ratios = [None , " 1/1" , " 3/2" , " 16/9" ],
160160 )
161161```
162162
@@ -263,6 +263,7 @@ available picture sizes in a DRF serializer.
263263from rest_framework import serializers
264264from pictures.contrib.rest_framework import PictureField
265265
266+
266267class PictureSerializer (serializers .Serializer ):
267268 picture = PictureField()
268269```
@@ -274,6 +275,7 @@ providing the `aspect_ratios` and `file_types` arguments to the DRF field.
274275from rest_framework import serializers
275276from pictures.contrib.rest_framework import PictureField
276277
278+
277279class PictureSerializer (serializers .Serializer ):
278280 picture = PictureField(aspect_ratios = [" 16/9" ], file_types = [" AVIF" ])
279281```
@@ -366,5 +368,4 @@ class MyPicture(Picture):
366368[ django-rq ] : https://github.com/rq/django-rq
367369[ dramatiq ] : https://dramatiq.io/
368370[ drf ] : https://www.django-rest-framework.org/
369- [ libavif-install ] : https://pillow.readthedocs.io/en/latest/installation/building-from-source.html#external-libraries
370371[ migration ] : tests/testapp/migrations/0002_alter_profile_picture.py
0 commit comments