
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
A set of utilities for creating gallery models and admin classes.
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!
.. code:: python
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
.
.. code:: python
from .models import ApartmentGallery
from galleries.admin import register_gallery_admin
register_gallery_admin(ApartmentGallery)
.. code:: python
INSTALLED_APPS = (
'imagekit',
...
)
This should register you new app with our galleries models and include the thumbnail preview.
FAQs
Simple Django galleries.
We found that django-galleries demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.