Skip to main content

Drag-to-reorder inline model admins for Django

Project description

Drag-to-reorder inline model admins for Django


pip install django-orderable-inlines

Add orderable_inlines to your INSTALLED_APPS.


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)

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 = [
    ], 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

django-orderable-inlines-0.0.6.tar.gz (15.5 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page