Code Monkey home page Code Monkey logo

django-galleryfield's Introduction

django-galleryfield

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://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

Note

You might need to install JSON1 extension for SQLite for this the demo to run properly. See Enabling JSON1 extension on SQLite.

Online documentation

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

Contribute to the project

See Contribution guide.

License

Released under the MIT license.

django-galleryfield's People

Contributors

dependabot[bot] avatar dzhuang avatar phoebebright avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.