A switchable ImageField for third party Django applications
Project description
django-any-imagefield
This module offers a abstraction over the various image fields, so allow third party applications can provide an imagefield at the project choice.
Supported image fields:
django-filebrowser-no-grappelli, which includes a preview and file selector.
django-filer, which includes a preview and file selector.
SORL-thumbnail, which includes a preview
Django’s default ImageField, with a preview added to it.
Installation
First install the module, preferably in a virtual environment. It can be installed from PyPI:
pip install django-any-imagefield
Configuration
Add the module to the installed apps:
INSTALLED_APPS += (
'any_imagefield',
)
Usage
In a Django model, the field can be included:
from django.db import models
from any_imagefield.models import AnyImageField
class Article(models.Model):
title = models.CharField("Title", max_length=200)
image = AnyImageField("Image", upload_to='images')
class Meta:
verbose_name = "Article"
verbose_name_plural = "Articles"
def __unicode__(self):
return self.title
By default, the AnyImageField displays a standard ImageField with a preview thumbnail. When django-filebrowser-no-grappelli is installed, it will use the FileBrowseField from that package to display the file/image browser. When your package has it’s own ImageField variant/subclass, please consider to add support for it in this package.
Contributing
This module is designed to be generic. In case there is anything you didn’t like about it, or think it’s not flexible enough, please let us know. We’d love to improve it!
If you have any other valuable contribution, suggestion or idea, please let us know as well because we will look into it. Pull requests are welcome too. :-)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django-any-imagefield-0.9.tar.gz
.
File metadata
- Download URL: django-any-imagefield-0.9.tar.gz
- Upload date:
- Size: 10.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8cc430b293648ebe4d1f01218d301b4e8f743bb19f4e522a036af4a66fb14810 |
|
MD5 | f177b161e0a5fff83ca48a6ec100031c |
|
BLAKE2b-256 | 8984b49aa2e687b4fd323f44ff56e8ce36d10ea3689961e82cd2d02368e58139 |
File details
Details for the file django_any_imagefield-0.9-py2.py3-none-any.whl
.
File metadata
- Download URL: django_any_imagefield-0.9-py2.py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e12429231d4db51b06b1cb558f7cc154a8695771cf8cb693e5d49c40723688e2 |
|
MD5 | 865253548f175551388f0b6c03e54662 |
|
BLAKE2b-256 | aa4a0b07aefd218065ed8442bdc0c53d37a9cfb9805c48c1cdebb6c386cb54fa |