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.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0858c384d067575f93e08a96aa3e7a3aa5b5869d4d36ca8274e621d2cefb169 |
|
MD5 | 4809b7cf58d37f036c3ec0a191db2d9f |
|
BLAKE2b-256 | f639b44a535c711fe388355be0993aa37ca3e5b1dd7b957a2a4a39900321821b |