Skip to main content

Wrestle your django inlines with jQuery and Grappelli.

Project description

django-inline-wrestler
=======================

Make django admin lists easier to sort with jQuery and Grappelli.

This plugin turns an ordinary order field into a high-powered sorting tool including:
* Drag-and-Drop
* Jump to Top and Jump to Bottom buttons
* Jump one up and Jump one bottom
* Send directly to a position in the list

For inline admin forms:
* Sort by a custom field
* Adjust table headers so they line up with the actual columns
* Make table headers sortable, so you can sort by a particular field (supports sorting by text inputs, text areas, check boxes, image uploads, and fks)
* Positioning order buttons anywhere in the table

![Screenshot of Django inline items](/../master/docs/screenshots/screenshot.png?raw=true "Screenshot of Tabular Inline Items")

![Screenshot of Django inline items](/../master/docs/screenshots/sort_by_columns.png?raw=true "Screenshot of Tabular Inline Items")

Requirements
=====
Requires Django and django-grappelli

Usage
=====
1. pip install django-inline-wrestler
2. Add 'django_inline_wrestler' to your INSTALLED_APPS list in your project's settings.py

```python
from django_inline_wrestler.admin import TabularInlineOrderable, AdminListOrderable

from .models import *

class ItemInline(TabularInlineOrderable):
"""
To bring drag-and-drop functionality to an inline:
"""
model = Item
fields = ('order', 'name', 'txtid', 'description')
prepopulated_fields = {'txtid': ('name',)}

class SubItemInline(TabularInlineOrderable):
"""
To bring drag-and-drop functionality to an inline, sorting on a custom field:
"""
model = SubItem
fields = ('position', 'name', 'txtid')
prepopulated_fields = {'txtid': ('name',)}

#To override which field is used for ordering, add a class starting with order-by-[fieldname]. Make sure to also include
classes = ['django-inline-wrestler', 'order-by-position']

class ObjectAdmin(AdminListOrderable):
"""
To bring drag-and-drop functionality to a changelist view:
"""
model = Object
fields = ('order', 'title')
list_editable = ('order',)

inlines = [ItemInline, SubItemInline]
```

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-inline-wrestler-5.0.tar.gz (11.4 kB view details)

Uploaded Source

File details

Details for the file django-inline-wrestler-5.0.tar.gz.

File metadata

File hashes

Hashes for django-inline-wrestler-5.0.tar.gz
Algorithm Hash digest
SHA256 39d53a7c3ef084241afe58c7b69f7e66a47523706c6a02aad3f2739f617a9b75
MD5 004499b31e35d2c2fd42d754a0dc662a
BLAKE2b-256 598cfcd606f761d28a75caf393d89dd657458c90749be1fefa007b87d669581a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page