Skip to main content

Adds an image plugin to django CMS

Project description

pypi build coverage

django CMS Picture is a plugin for django CMS that allows you to add images on your site.

This addon is compatible with Divio Cloud and is also available on the django CMS Marketplace for easy installation.

preview.gif

Contributing

This is a an open-source project. We’ll be delighted to receive your feedback in the form of issues and pull requests. Before submitting your pull request, please review our contribution guidelines.

We’re grateful to all contributors who have helped create and maintain this package. Contributors are listed at the contributors section.

One of the easiest contributions you can make is helping to translate this addon on Transifex.

Documentation

See REQUIREMENTS in the setup.py file for additional dependencies:

python django djangocms

  • Django Filer 1.7 or higher

Make sure django-filer is installed and configured appropriately.

Installation

For a manual install:

  • run pip install djangocms-picture

  • add djangocms_picture to your INSTALLED_APPS

  • run python manage.py migrate djangocms_picture

Configuration

Note that the provided templates are very minimal by design. You are encouraged to adapt and override them to your project’s requirements.

This addon provides a default template for all instances. You can provide additional template choices by adding a DJANGOCMS_PICTURE_TEMPLATES setting:

DJANGOCMS_PICTURE_TEMPLATES = [
    ('background', _('Background image')),
]

You’ll need to create the background folder inside templates/djangocms_picture/ otherwise you will get a template does not exist error. You can do this by copying the default folder inside that directory and renaming it to background.

Another setting is DJANGOCMS_PICTURE_NESTING, which allows you to render an image as the background image of a container that also contains other content (text, icons and so on).

DJANGOCMS_PICTURE_NESTING = True

will enable this (the default is False). When set to True, you’ll be able to place additional plugins inside the picture plugin.

You can override alignment styles with DJANGOCMS_PICTURE_ALIGN, for example:

DJANGOCMS_PICTURE_ALIGN = [
    ('top', _('Top Aligned')),
]

This will generate a class prefixed with align-. The example above would produce a class="align-top". Adding a class key to the image attributes automatically merges the alignment with the attribute class.

You can enable responsive images technique by setting``DJANGOCMS_PICTURE_RESPONSIVE_IMAGES`` to True. In this case uploaded images will create thumbnails of different sizes according to DJANGOCMS_PICTURE_RESPONSIVE_IMAGES_VIEWPORT_BREAKPOINTS (which defaults to [576, 768, 992]) and browser will be responsible for choosing the best image to display (based upon the screen viewport).

You can use DJANGOCMS_PICTURE_RATIO to set the width/height ratio of images if these values are not set explicitly on the image:

DJANGOCMS_PICTURE_RATIO = 1.618

We use the golden ratio, approximately 1.618, as a default value for this.

When working out sizes for the image, the system will use the following values, of preference:

  • the width or height set in the Thumbnail options

  • Autoscale

  • the Width and Height

We recommend setting width or height values around a placeholder so when the plugin uses Autoscale it can discover them:

{% with 720 as width and 480 as height %}
    {% placeholder content %}
{% endwith %}

Further configuration can be achieved through the django Filer settings.

Running Tests

You can run tests by executing:

virtualenv env
source env/bin/activate
pip install -r test_requirements/base.txt
python setup.py test

Download files

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

Source Distribution

djangocms-picture-3.0.0.tar.gz (47.8 kB view details)

Uploaded Source

Built Distribution

djangocms_picture-3.0.0-py3-none-any.whl (208.9 kB view details)

Uploaded Python 3

File details

Details for the file djangocms-picture-3.0.0.tar.gz.

File metadata

  • Download URL: djangocms-picture-3.0.0.tar.gz
  • Upload date:
  • Size: 47.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for djangocms-picture-3.0.0.tar.gz
Algorithm Hash digest
SHA256 d6efc414f044ee373126dac81c14e5a95983b2fa76a85e91a7e1328d62f0e57c
MD5 4a3c1bbcd4aabd0487f95cd64f7b3c7c
BLAKE2b-256 bb5cff0bfa103f969ef257fe24acc4285dc967ca2ba869784375bbed46728379

See more details on using hashes here.

File details

Details for the file djangocms_picture-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: djangocms_picture-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 208.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for djangocms_picture-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 487b72f3c251745c062c052ef87a3e7f9ba458cf67534f13e92c684524e941ef
MD5 7ac42d3faaaa66f1b1c34f0676101bc6
BLAKE2b-256 e0b1e5a0b11ddb801ef2710fd0c6a5356159adafaa1a66f4f4495771164caf46

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page