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)
Metadata
Release files for django-orderable-inlines 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-orderable-inlines-0.0.6.tar.gz | 15.5 kB | Details |
Release files / django-orderable-inlines-0.0.6.tar.gz
| Download URL | django-orderable-inlines-0.0.6.tar.gz |
|---|---|
| Size | 15.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0e5ebd1579eeab0c978df10f86201764795908249990b629046b2d98d268baca
|
|
BLAKE2b-256 checksum How to use checksums |
1e294f779627291fbc0b4f200cbd577ecd7ccf61a219eb741ac36ee38f582289
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |