This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Simple Django galleries.

Project Description

A set of utilities for creating gallery models and admin classes.

Example:

models.py

Define models for all of the types you want to put in your gallery, then create a Gallery subclass that specifies which models to allow for its members.

Attention!

In older versions, we recommended that you extend django-gallery’s included ImageModel or EmbedModel classes if your gallery contained those types. Those models are now deprecated. Just define your own!

from galleries.models import Gallery
from imagekit.models import ImageSpec
from imagekit.processors import Crop


class YouTubeVideo(models.Model):
    title = models.CharField(max_length=50)
    embed_code = models.TextField()
    thumbnail = models.ProcessedImageField([Crop(60, 60)],
                                            upload_to='gallery_posters')

class Photo(models.Model)
    title = models.CharField(max_length=50)
    description = models.CharField(max_length=255, blank=True)
    original_image = models.ImageField(upload_to='galleries')
    thumbnail = models.ImageSpec([Crop(60, 60)], image_field='original_image')


class ApartmentGallery(Gallery):

    class GalleryMeta:
        member_models = [Photo, YouTubeVideo]

The gallery class will automatically create a membership (through) model, which will be accessible at ApartmentGallery.Membership.

admin.py

from .models import ApartmentGallery
from galleries.admin import register_gallery_admin

register_gallery_admin(ApartmentGallery)

settings.py

INSTALLED_APPS = (
    'imagekit',
    ...
)

This should register you new app with our galleries models and include the thumbnail preview.

Release History

Release History

This version
History Node

1.4.0

History Node

1.3.0

History Node

1.2.0

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-galleries-1.4.0.tar.gz (12.4 kB) Copy SHA256 Checksum SHA256 Source Apr 23, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting