Pinax Images
Table of Contents
- About Pinax
- Important Links
- Overview
- Documentation
- Change Log
- Contribute
- Code of Conduct
- Connect with Pinax
- License
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 http://pinaxproject.com.
Important Links
Where you can find what you need:
- Releases: published to PyPI or tagged in app repos in the Pinax GitHub organization
- Global documentation: Pinax documentation website
- App specific documentation: app repos in the Pinax GitHub organization
- Support information: SUPPORT.md file in the Pinax default community health file repo
- Contributing information: CONTRIBUTING.md file in the Pinax default community health file repo
- Current and historical release docs: Pinax Wiki
pinax-images
Overview
pinax-images is an app for managing collections of images associated with any content object.
Dependencies
django-appconf>=1.0.1django-imagekit>=3.2.7pilkit>=1.1.13pillow>=3.3.0pytz>=2016.6.1
Supported Django and Python Versions
| Django / Python | 3.6 | 3.7 | 3.8 | 3.9 | 3.10 |
|---|---|---|---|---|---|
| 2.2 | * | * | * | * | * |
| 3.2 | * | * | * | * | * |
Documentation
Installation
To install pinax-images:
$ pip install pinax-images
Add pinax.images to your INSTALLED_APPS setting:
INSTALLED_APPS = [
# other apps
"pinax.images",
]
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")),
]
Usage
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" image_set.pk 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" image_set.pk %}{% endif %}"
data-upload-url="{{ upload_url }}"
data-image-set-id="{{ image_set.pk }}">
</div>
Settings
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/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 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 settings.py::
PINAX_IMAGES_THUMBNAIL_SPEC = "{{my_app}}.specs.MyCustomImageThumbnail"
Change Log
5.0.0
- Add Python 3.9 and 3.10 support along with Django 3.2
- Droppped Django 3.1
- Handled deprecation and some general modernizations
- Updated packaging
4.0.1
- Drop Django 1.11, 2.0, and 2.1, and Python 2,7, 3.4, and 3.5 support
- Add Django 2.2 and 3.0, and Python 3.6, 3.7, and 3.8 support
- Update packaging configs
- Direct users to community resources
3.0.2
- Use format_html() to escape html tags in admin preview
3.0.1
- Standardize documentation, badges
- Remove django-appconf from setup.py
install_requires - Add third-party libs for isort-ing
- Add trove classifiers
3.0.0
- 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 README.md
2.2.0
- Move documentation to README.md
- Change
upload_topath to have the image set PK
2.1.0
- Only how thumbnail if one exists
2.0.0
-
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.
1.0.0
- Update version for Pinax 16.04 release
0.2.1
- Improve documentation
0.2.0
- Make DUA an optional requirement PR #14
0.1.1
- add Pillow to install requires
0.1
- initial release
Contribute
Contributing information can be found in the Pinax community health file repo.
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.
License
Copyright (c) 2012-present James Tauber and contributors under the MIT license.
Release files for pinax-images 5.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pinax-images-5.0.1.tar.gz | 13.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pinax_images-5.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.6 kB
Release files / pinax-images-5.0.1.tar.gz
| Download URL | pinax-images-5.0.1.tar.gz |
|---|---|
| Size | 13.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8e5a27fad5231cb77a6284445f941c8523eefe5e39c0a5c6182f614613893024
|
|
BLAKE2b-256 checksum How to use checksums |
35bc79791769039a5ca8f4836c72f8c1b5bb29b6c41cceadf63919192a5707a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.8
|
Release files / pinax_images-5.0.1-py3-none-any.whl
| Download URL | pinax_images-5.0.1-py3-none-any.whl |
|---|---|
| Size | 13.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f4eb58c59a2696bba506fd2cbd16299586f4056dfb87a913ff321808f12fb1a8
|
|
BLAKE2b-256 checksum How to use checksums |
81e7031d79ea58629c856ff2e749c61a0ce8b6c015b01613f65dc8afb619725b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.8
|