Drag-to-reorder inline model admins for Django
Project description
Drag-to-reorder inline model admins for Django
Installation
pip install django-orderable-inlines
Add orderable_inlines to your INSTALLED_APPS.
Example
models.py:
from django.db import models class Gallery(models.Model): name = models.CharField(max_length=16) class Photo(models.Model): gallery = models.ForeignKey(Gallery) image = models.ImageField(upload_to='gallery_photos') order = models.PositiveIntegerField(default=1)
admin.py:
from django.contrib import admin from gallery.models import Gallery, Photo from orderable_inlines import OrderableTabularInline class PhotoInline(OrderableTabularInline): model = Book orderable_field = 'order' class GalleryAdmin(admin.ModelAdmin): inlines = [ PhotoInline, ] admin.site.register(Gallery, GalleryAdmin)
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
Close
Hashes for django-orderable-inlines-0.0.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e5ebd1579eeab0c978df10f86201764795908249990b629046b2d98d268baca |
|
MD5 | eff425903ca532e55d2c724f80c36fb1 |
|
BLAKE2b-256 | 1e294f779627291fbc0b4f200cbd577ecd7ccf61a219eb741ac36ee38f582289 |