django-suit-sortable
Drag-and-drop ordering for objects and inlines in Django admin using [django-suit](https://github.com/darklow/django-suit).
- ## Installation
pip install -e git://github.com/JP74/django-suit-sortable.git#egg=suit_sortable
## Configuration
Add suit_sortable to your INSTALLED_APPS.
Ensure django.core.context_processors.static is in your TEMPLATE_CONTEXT_PROCESSORS.
To use suit_sortable you must do following:
In your models.py file add integer property for sortable to you model:
from django.db import models
- class Category(models.Model):
… position = models.PositiveIntegerField()
### Adding Sortable to an existing model
If you’re adding Sorting to an existing model, it is recommended that you use [django-south](http://south.areacode.com/) to create a schema migration to add the “position” field to your model. You will also need to create a data migration in order to add the appropriate values for the position column.
Example assuming a model named “Category”:
- def forwards(self, orm):
- for index, category in enumerate(orm.Category.objects.all()):
category.position = index + 1 category.save()
### Django Admin Integration To enable sorting in the admin, you need to inherit from SortableAdmin and add a list_editable column for the position field:
from django.contrib import admin from myapp.models import MySortableClass from suit_sortable.admin import SortableAdmin
- class MySortableAdminClass(SortableAdmin):
list_display = (…, ‘position’,) list_editable = (‘position’,) “””Any other admin options you need go here”””
admin.site.register(MySortableClass, MySortableAdminClass)
To enable sorting on TabularInline models, you need to inherit from SortableTabularInline:
from suit_sortable.admin import SortableTabularInline
- class MySortableTabularInline(SortableTabularInline):
“””Your inline options go here”””
To enable sorting on StackedInline models, you need to inherit from SortableStackedInline:
from suit_sortable.admin import SortableStackedInline
- class MySortableStackedInline(SortableStackedInline):
“””Your inline options go here”””
### Limitations
Since sortables are based on JavaScript solution, there are known limitations:
It doesn’t work with pagination.
History
0.1.0 (2013-08-15)
First release on Github.
Metadata
Release files for django-suit-sortable 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-suit-sortable-0.1.0.tar.gz | 16.5 kB | Without provenance | Details for django-suit-sortable-0.1.0.tar.gz |
Release files / django-suit-sortable-0.1.0.tar.gz
| Download URL | django-suit-sortable-0.1.0.tar.gz |
|---|---|
| Size | 16.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
45b17bce6ffc0351d70df463d0af202f33579ba2f98aef7aeac40dc08d4e28ca
|
|
BLAKE2b-256 checksum How to use checksums |
fa68e3413f45b07eac3885358ba5cd4f7f48800278f9ed608a1eb301e286396f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-suit-sortable 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.