The Gallery module organises NAMETS photos into date-stamped albums. Each album (Gallery) holds one or more images (GalleryImage) stored in Cloudinary, with support for individual captions and manual image ordering. Albums are ordered by event date so the most recent activity always appears first.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Muhammadbugaje/NAMETS_Website/llms.txt
Use this file to discover all available pages before exploring further.
Data Models
Gallery
An album representing a single event, activity, or theme.| Field | Type | Notes |
|---|---|---|
title | CharField | Album title, max 200 chars |
description | TextField | Optional description of the event or occasion |
date | DateField | Date of the event; defaults to today |
cover_image | CloudinaryField | Optional cover image stored in Cloudinary gallery/ folder |
created_at | DateTimeField | Auto-set when the album is created |
-date (newest event first), then -created_at as a tiebreaker. This means a freshly created album for today will always appear at the top.
GalleryImage
An individual photo within an album.| Field | Type | Notes |
|---|---|---|
gallery | ForeignKey | Parent Gallery; deletes images if album is deleted |
image | CloudinaryField | Stored in Cloudinary gallery/ folder |
caption | CharField | Short description of the photo (optional), max 200 chars |
order | PositiveIntegerField | Manual position within the album; lower = first |
order (ascending) within their album. Assign order = 0 to all images for automatic FIFO ordering, or set distinct values for a custom sequence.
Cloudinary Integration
All images — both album covers and individual gallery photos — are stored in Cloudinary under thegallery/ folder path. This means:
- Images are served via Cloudinary’s global CDN for fast delivery.
- Cloudinary handles format optimisation and responsive variants automatically.
- Deleting an image from the admin removes the database record but does not automatically purge the asset from Cloudinary storage; manual cleanup may be needed for storage management.
Both the
Gallery.cover_image and GalleryImage.image fields use folder='gallery' in their CloudinaryField definition, so all gallery assets are grouped together in the Cloudinary media library.URL Routes
All routes are under thegallery app namespace with the URL prefix /gallery/.
| Name | URL Pattern | View | Description |
|---|---|---|---|
list | /gallery/ | gallery_list | Paginated list of all albums |
detail | /gallery/<int:pk>/ | gallery_detail | Single album with all its images |
Managing Albums
Create a new Gallery album
In the Django admin, navigate to Gallery → Galleries and click Add Gallery. Enter a title, the event date, an optional description, and an optional cover image.
Add images to the album
After saving the album, open it again and use the GalleryImage inline to upload photos. For each image, optionally add a caption and set the
order field to control the sequence.Set a cover image
Upload a representative photo in the
cover_image field of the Gallery record. This image is displayed on the album list page as the album thumbnail.Album List View
The
gallery_list view renders all Gallery records ordered by -date, -created_at. Each album shows its cover image (if set), title, date, and description excerpt.Album Detail View
The
gallery_detail view accepts a primary key (pk) and renders the full album with all associated GalleryImage records sorted by order.