an app for managing collections of images associated with a content object
Python Makefile
Clone or download
Latest commit dcb31ae Jan 19, 2018

Pinax Images

CircleCi Codecov

Table of Contents

About Pinax

Pinax is an open-source platform built on the Django Web Framework. It is an ecosystem of reusable Django apps, themes, and starter project templates. This collection can be found at



pinax-images is an app for managing collections of images associated with any content object.

Supported Django and Python versions

Django \ Python 2.7 3.4 3.5 3.6
1.11 * * * *
2.0 * * *


  • django-appconf>=1.0.1
  • django-imagekit>=3.2.7
  • pilkit>=1.1.13
  • pillow>=3.0
  • pytz>=2015.6



To install pinax-images:

    $ pip install pinax-images

Add pinax.images to your INSTALLED_APPS setting:

    # other apps

pinax-images-specific settings can be found in the Settings section.

Add pinax.images.urls to your project urlpatterns:

    urlpatterns = [
        # other urls
        url(r"^ajax/images/", include("pinax.images.urls", namespace="pinax_images")),


Adding image collection functionality to your application!

First, add a OneToOneField on your content object to ImageSet::

from pinax.images.models import ImageSet

class YourModel():
    # other fields
    image_set = models.OneToOneField(ImageSet)

In your view for creating your content object, you should create a new ImageSet for each new content object:

class ObjectCreateView(CreateView):

    def form_valid(self, form):
        form.instance.image_set = ImageSet.objects.create(created_by=self.request.user)
        return super(CloudSpottingCreateView, self).form_valid(form)

Finally, you'll want to include a snippet like this wherever you want the image panel to appear (if you are using the associated pinax-images-panel ReactJS frontend):

{% if image_set %}
    {% url "pinax_images:imageset_upload" as upload_url %}
{% else %}
    {% url "pinax_images:imageset_new_upload" as upload_url %}
{% endif %}
<div id="image-panel" data-images-url="{% if image_set %}{% url "pinax_images:imageset_detail" %}{% endif %}"
                        data-upload-url="{{ upload_url }}"
                        data-image-set-id="{{ }}">


The following settings allow you to specify the behavior of pinax-images in your project.

Customizing Thumbnail Specs

By default pinax-images maintains four thumbnail specifications for thumbnail generation of uploaded images. These specifications (shown below) are located in pinax/images/

PINAX_IMAGES_THUMBNAIL_SPEC = "pinax.images.specs.ImageThumbnail"
PINAX_IMAGES_LIST_THUMBNAIL_SPEC = "pinax.images.specs.ImageListThumbnail"
PINAX_IMAGES_SMALL_THUMBNAIL_SPEC = "pinax.images.specs.ImageSmallThumbnail"
PINAX_IMAGES_MEDIUM_THUMBNAIL_SPEC = "pinax.images.specs.ImageMediumThumbnail"

You can customize thumbnailing options by creating your own specification class inheriting from ImageSpec:

from imagekit import ImageSpec
from pilkit.processors import ResizeToFit

class MyCustomImageThumbnail(ImageSpec):
    processors = [ResizeToFit(800, 600)]
    format = "JPEG"
    options = {"quality": 90}

and overriding pinax-image specs in your application

PINAX_IMAGES_THUMBNAIL_SPEC = "{{my_app}}.specs.MyCustomImageThumbnail"

Change Log


  • Standardize documentation, badges
  • Remove django-appconf from install_requires
  • Add third-party libs for isort-ing
  • Add trove classifiers


  • Add Django 2.0 compatibility testing
  • Drop Django 1.8, 1.9, 1.10 and Python 3.3 support
  • Convert CI and coverage to CircleCi and CodeCov
  • Add PyPi-compatible long description
  • Move documentation to


  • Move documentation to
  • Change upload_to path to have the image set PK


  • Only how thumbnail if one exists


  • Revise access permissions for some views:

    • ImageSet detail view now accessible by any authenticated user
    • Image delete view now accessible only by image owner.
    • Image "toggle primary" view now accessible only by image owner.


  • Update version for Pinax 16.04 release


  • Improve documentation


  • Make DUA an optional requirement PR #14


  • add Pillow to install requires


  • initial release


For an overview on how contributing to Pinax works read this blog post and watch the included video, or read our How to Contribute section. For concrete contribution ideas, please see our Ways to Contribute/What We Need Help With section.

In case of any questions we recommend you join our Pinax Slack team and ping us there instead of creating an issue on GitHub. Creating issues on GitHub is of course also valid but we are usually able to help you faster if you ping us in Slack.

We also highly recommend reading our blog post on Open Source and Self-Care.

Code of Conduct

In order to foster a kind, inclusive, and harassment-free community, the Pinax Project has a code of conduct. We ask you to treat everyone as a smart human programmer that shares an interest in Python, Django, and Pinax with you.

Connect with Pinax

For updates and news regarding the Pinax Project, please follow us on Twitter @pinaxproject and check out our Pinax Project blog.


Copyright (c) 2012-2018 James Tauber and contributors under the MIT license.