Skip to main content

Django AJAX upload widget and model field for multiple images, featuring drag & drop uploading, upload progress bar, sortable and croppable image gallery

Project description

https://codecov.io/gh/dzhuang/django-galleryfield/branch/main/graph/badge.svg?token=W9BWM4A4RI https://github.com/dzhuang/django-galleryfield/actions/workflows/ci.yml/badge.svg?branch=main https://badge.fury.io/py/django-galleryfield.svg https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336 Documentation Status

Django model fields GalleryField with AJAX form widgets and for multiple images upload with progress bar. This package is NOT about how to elegantly render multiple images in a page, but how to CRUD multiple images in a model field, which makes it possible for easy permission control.

Features

  • A model field GalleryField, and its formfield GalleryFormField along with the default widget GalleryWidget.

  • Drag & drop file uploading via AJAX

  • Uploading multiple images with progress bar

  • Drag & drop reordering, client / server side crop before/after upload.

  • Integrates with Django Admin.

  • Each Image uploaded will be saved in an image model. That might be considered, by some user, a draw back. However, that makes it possible to delete the orphan images from the server (see in FAQ).

ScreenShots

  • Multiple image upload, sortable

https://raw.githubusercontent.com/dzhuang/django-galleryfield/main/demo/static/demo/screen_upload.png
  • Client/Server side crop

https://raw.githubusercontent.com/dzhuang/django-galleryfield/main/demo/static/demo/screen_crop.png
  • Easy Gallery render

https://raw.githubusercontent.com/dzhuang/django-galleryfield/main/demo/static/demo/screen_detail.png

Quick Start

Requirements

Install

pip install django-galleryfield

Usage

  • In settings.py, add 3 lines in you INSTALLED_APP:

INSTALLED_APPS = (
    ...,
    'sorl.thumbnail',
    'galleryfield',
    ...,
)

DJANGO_GALLERY_CONFIG = ...
  • In urls.py, add the following lines:

from django.urls import include, path

urlpatterns += [path(r"gallery-handler/", include("galleryfield.urls"))]
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

Run the demo

git clone https://github.com/dzhuang/django-galleryfield.git
cd django-galleryfield
cd demo
pip install -r requirements.txt
cd ..
python manage.py migrate
python manage.py createsuperuser # Create a superuser account so that you can upload images
python manage.py runserver

Online documentation

Please visit https://django-galleryfield.readthedocs.io for the documentation.

License

Released under the MIT license.

Project details


Download files

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

Source Distribution

django-galleryfield-1.5.0.dev0.tar.gz (1.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_galleryfield-1.5.0.dev0-py3-none-any.whl (1.7 MB view details)

Uploaded Python 3

File details

Details for the file django-galleryfield-1.5.0.dev0.tar.gz.

File metadata

File hashes

Hashes for django-galleryfield-1.5.0.dev0.tar.gz
Algorithm Hash digest
SHA256 3e6284bb772c9fd62f27a3b7358d0596cf7d0309aa38534a2ba020f0e6e038e4
MD5 f1e3672c4456b68b4109e1b82933dc00
BLAKE2b-256 dccaab08c43663816cae7465da8e3bb776077a9f862ef255addb06ff8be6cc7d

See more details on using hashes here.

File details

Details for the file django_galleryfield-1.5.0.dev0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_galleryfield-1.5.0.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 ca8e9904e03d1db00a352d2f3b36b15e9b3b79c7fc5449060793073f5588df05
MD5 79b7d564d2b5487d4976efad07f6c083
BLAKE2b-256 a3db94d409409fd696ca4e8370983eac5581e01783af0729b714e32f0ad5b73b

See more details on using hashes here.

Supported by

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