Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

An image serializer field for use with sorl and Django REST Framework.

Project Description

An image serializer field for use with sorl and Django REST Framework.

Provides an easy way of exposing a scaled version of an image rather than the full-size one, and if you prefer several different versions (thumb, large etc.)



pip install sorl-thumbnail-serializer-field


pip install -e

Quick start

  1. Add 'sorl_thumbnail_serializer' to the list of installed applications in your project’s file. Make sure you have already installed and configured sorl-thumbnail and Django REST Framework as well, if not do so now.
  2. Add the HyperlinkedSorlImageField to your serializer class.
  3. Specify the image dimensions and cropping options that the REST API should use.

Example usage

from django.conf.urls import url, include
from models import TestModel
from rest_framework import routers, serializers, viewsets
from sorl_thumbnail_serializer.fields import HyperlinkedSorlImageField

class TestModelSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = TestModel

    # A thumbnail image, sorl options and read-only
    thumbnail = HyperlinkedSorlImageField(
        options={"crop": "center"},

    # A larger version of the image, allows writing
    image = HyperlinkedSorlImageField('1024')

class TestModelViewSet(viewsets.ModelViewSet):
    queryset = TestModel.objects.all()
    serializer_class = TestModelSerializer

router = routers.DefaultRouter()
router.register(r'test_models', TestModelViewSet)

urlpatterns = [
    url(r'^', include(router.urls)),
Release History

Release History

This version
History Node


History Node


History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
sorl_thumbnail_serializer_field-0.2.1-py2.py3-none-any.whl (14.0 kB) Copy SHA256 Checksum SHA256 3.5 Wheel Oct 5, 2017
sorl-thumbnail-serializer-field-0.2.1.tar.gz (8.1 kB) Copy SHA256 Checksum SHA256 Source Oct 5, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting