Skip to main content

djangocms-masonry is a reuseable plugin for django-cms that implements the JavaScript Masonry library.

Dependencies

  • Djangocms>=3.0

  • Django>=1.6

Installation

Install djangocms-masonry from Pypi.

pip install djangocms-masonry

Add Djangocms_masonry to INSTALLED_APPS

INSTALLED_APPS = (
    ...
    'djangocms_masonry',
    ...
)

Django 1.6 and/or South users will need to add the following to ensure migration compatibility.

SOUTH_MIGRATION_MODULES = {
    ...
    'djangocms_masonry': 'djangocms_masonry.south_migrations',
    ...
}

Configuration

CSS classes can be added to the plugin via a select box by using the DJANGOCMS_MASONRY_STYLES settings tuple.

DJANGOCMS_MASONRY_STYLES = (
    ('style1', 'Style 1'),
    ('style2', 'Style 2'),
)

djangocms_masonry/default.html is rendered by default. The user can select custom templates if the following tuple is set as the example below demonstrates.

DJANGOCMS_MASONRY_TEMPLATES = (
    ('template1', 'Template 1'),
    ('template2', 'Template 2'),
)

Restrict the plugins available to Masonry Carousel

DJANGOCMS_MASONRY_CHILD_CLASSES = (
    'PicturePlugin',
)

Include or exclude static files

DJANGOCMS_MASONRY_INCLUDE_JS_MASONRY = True

Templates

base.html includes all the JavaScript and CSS needed to run the masonry plugin, but it does not render the HTML. Custom templates can extend base.html as long as they define a plugin block containing the html and plugin render code as show in the below example.

{% extends 'djangocms_masonry/base.html' %}
{% load cms_tags %}

{% block plugin %}
  <div class="masonry-plugin plugin{% if style %} {{ style }}{% endif %}" id="plugin-{{ instance.pk }}">
    <div class="row">
      <div class="small-12 columns">

        <div class="masonry-grid">
          <div class="grid-sizer"></div>
          <div class="gutter-sizer"></div>
          {% for plugin in instance.child_plugin_instances %}
            <div class="grid-item">
              {% render_plugin plugin %}
            </div>
          {% endfor %}
        </div>

      </div>
    </div>
  </div>
{% endblock plugin %}

Contributions

  • Lee Solway

History

0.1.0 (2015-07-24)

  • First release on PyPI

Release files for djangocms-masonry 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for djangocms-masonry 0.1.0
File Size Uploaded
djangocms-masonry-0.1.0.tar.gz 41.1 kB Details

Release files / djangocms-masonry-0.1.0.tar.gz

Download URL djangocms-masonry-0.1.0.tar.gz
Size 41.1 kB
Tags Source
SHA-256 checksum
How to use checksums
84e7c31b910c0f22ae0f1fa7dc3a8fb84acc2d5819f084b7db3528aaa2ff09d3
BLAKE2b-256 checksum
How to use checksums
d997444897723b6db094905ef1f34a658ec90e464bc4e73b66b7b0090b149c14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page