https://github.com/20tab/twentytab-sortable
A django model and admin to create sortable items in django admin with jqueryui sortable method
https://github.com/20tab/twentytab-sortable
Last synced: about 1 year ago
JSON representation
A django model and admin to create sortable items in django admin with jqueryui sortable method
- Host: GitHub
- URL: https://github.com/20tab/twentytab-sortable
- Owner: 20tab
- License: mit
- Created: 2014-02-09T17:03:03.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2015-02-06T11:24:35.000Z (over 11 years ago)
- Last Synced: 2025-03-01T14:19:20.014Z (over 1 year ago)
- Language: JavaScript
- Size: 470 KB
- Stars: 2
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
twentytab-sortable
==================
A django model and admin to create sortable items in django admin with jqueryui sortable method
## Installation
Use the following command: pip install twentytab-sortable
## Configuration
- Settings.py
Open settings.py and add sortable to your INSTALLED_APPS:
```py
INSTALLED_APPS = [
...
'sortable',
...
]
```
- Static files
Run collectstatic command or map static directory.
## Usage
- models.py
```py
from sortable.models import PositionModel
class MyPositionModel(PositionModel):
pass
```
- admin.py
```py
from django.contrib import admin
from myapp.models import MyPositionModel
from sortable.admin import PositionAdmin, SortableTabularInline, SortableStackedInline
class MyTabularInline(SortableTabularInline):
# add 'position' in your fields
model = APositionModel
class MyStackedInline(SortableStackedInline):
# add 'position' in your fields
model = APositionModel
class MyPositionAdmin(PositionAdmin):
inlines = [MyTabularInline, MyStackedInline]
# add 'position' in your list_editable fields
admin.site.register(MyPositionModel, MyPositionAdmin)
```