Package: pinax-images
Pinax ImagesTable of ContentsAbout PinaxImportant LinksOverviewDependenciesSupported Django and Python VersionsDocumentationInstallationUsageSettingsChange LogContributeCode of ConductConnect with PinaxLicenseAbout PinaxPinax 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 athttp://pinaxproject.com.Important LinksWhere you can find what you need:Releases: published toPyPIor tagged in app repos in thePinax GitHub organizationGlobal documentation:Pinax documentation websiteApp specific documentation: app repos in thePinax GitHub organizationSupport information:SUPPORT.mdfile in thePinax default community health file repoContributing information:CONTRIBUTING.mdfile in thePinax default community health file repoCurrent and historical release docs:Pinax Wikipinax-imagesOverviewpinax-imagesis an app for managing collections of images associated with any content object.Dependenciesdjango-appconf>=1.0.1django-imagekit>=3.2.7pilkit>=1.1.13pillow>=3.3.0pytz>=2016.6.1Supported Django and Python VersionsDjango / Python3.63.73.83.93.102.2*****3.2*****DocumentationInstallationTo install pinax-images:$pipinstallpinax-imagesAddpinax.imagesto yourINSTALLED_APPSsetting:INSTALLED_APPS=[# other apps"pinax.images",]pinax-images-specific settings can be found in theSettingssection.Addpinax.images.urlsto your project urlpatterns:urlpatterns=[# other urlsurl(r"^ajax/images/",include("pinax.images.urls",namespace="pinax_images")),]UsageAdding image collection functionality to your application!First, add aOneToOneFieldon your content object toImageSet::frompinax.images.modelsimportImageSetclassYourModel():# other fieldsimage_set=models.OneToOneField(ImageSet)In your view for creating your content object, you should create a
new ImageSet for each new content object:classObjectCreateView(CreateView):defform_valid(self,form):form.instance.image_set=ImageSet.objects.create(created_by=self.request.user)returnsuper(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 associatedpinax-images-panelReactJS frontend):{%ifimage_set%}{%url"pinax_images:imageset_upload"image_set.pkasupload_url%}{%else%}{%url"pinax_images:imageset_new_upload"asupload_url%}{%endif%}<div id="image-panel" data-images-url="{%ifimage_set%}{%url"pinax_images:imageset_detail"image_set.pk%}{%endif%}"data-upload-url="{{upload_url}}"data-image-set-id="{{image_set.pk}}"></div>SettingsThe following settings allow you to specify the behavior ofpinax-imagesin
your project.Customizing Thumbnail SpecsBy defaultpinax-imagesmaintains four thumbnail specifications for thumbnail generation of uploaded images.
These specifications (shown below) are located inpinax/images/specs.py.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 fromImageSpec:fromimagekitimportImageSpecfrompilkit.processorsimportResizeToFitclassMyCustomImageThumbnail(ImageSpec):processors=[ResizeToFit(800,600)]format="JPEG"options={"quality":90}and overriding pinax-image specs in your applicationsettings.py::PINAX_IMAGES_THUMBNAIL_SPEC="{{my_app}}.specs.MyCustomImageThumbnail"Change Log5.0.0Add Python 3.9 and 3.10 support along with Django 3.2Droppped Django 3.1Handled deprecation and some general modernizationsUpdated packaging4.0.1Drop Django 1.11, 2.0, and 2.1, and Python 2,7, 3.4, and 3.5 supportAdd Django 2.2 and 3.0, and Python 3.6, 3.7, and 3.8 supportUpdate packaging configsDirect users to community resources3.0.2Use format_html() to escape html tags in admin preview3.0.1Standardize documentation, badgesRemove django-appconf from setup.pyinstall_requiresAdd third-party libs for isort-ingAdd trove classifiers3.0.0Add Django 2.0 compatibility testingDrop Django 1.8, 1.9, 1.10 and Python 3.3 supportConvert CI and coverage to CircleCi and CodeCovAdd PyPi-compatible long descriptionMove documentation to README.md2.2.0Move documentation to README.mdChangeupload_topath to have the image set PK2.1.0Only how thumbnail if one exists2.0.0Revise access permissions for some views:ImageSet detail view now accessible by any authenticated userImage delete view now accessible only by image owner.Image "toggle primary" view now accessible only by image owner.1.0.0Update version for Pinax 16.04 release0.2.1Improve documentation0.2.0Make DUA an optional requirementPR #140.1.1add Pillow to install requires0.1initial releaseContributeContributinginformation can be found in thePinax community health file repo.Code of ConductIn order to foster a kind, inclusive, and harassment-free community, the Pinax Project has aCode 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 PinaxFor updates and news regarding the Pinax Project, please follow us on Twitter@pinaxprojectand check out ourPinax Project blog.LicenseCopyright (c) 2012-present James Tauber and contributors under theMIT license.