Skip to content

Commit 22288ad

Browse files
committed
Bump to version 2.1
1 parent 7ce50a2 commit 22288ad

File tree

5 files changed

+33
-4
lines changed

5 files changed

+33
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
## Release history of [django-admin-sortable2](https://github.com/jrief/django-admin-sortable2/)
44

5+
### 2.1
6+
- Introduce classes `adminsortable2.admin.SortableStackedInline` and `adminsortable2.admin.SortableTabularInline`
7+
to resort items to the begin or end of the list of those inlines.
8+
- Add support for Django-4.1.
9+
510
### 2.0.5
611
- Fix: When using an `InlineAdmin` with a self defined form, the default ordering
712
has been ignored.

adminsortable2/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '2.0.5'
1+
__version__ = '2.1'
137 KB
Loading
106 KB
Loading

docs/source/usage.rst

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,18 @@ If a model on the same page has a parent model, these are called inlines. Suppos
137137
model for chapters and want to edit the chapter together with the book's title using the same
138138
editor, then Django admin offers the classes :class:`~django.contrib.admin.StackedInline` and
139139
:class:`~django.contrib.admin.TabularInline`. To make these inline admin interfaces sortable,
140-
we simple use the mixin class :class:`adminsortable2.admin.SortableAdminMixin`. Example:
140+
we simple use the mixin class :class:`adminsortable2.admin.SortableAdminMixin`.
141+
142+
Example:
141143

142144
.. code-block:: python
143145
144146
...
147+
from adminsortable2.admin import SortableStackedInline
148+
145149
from myapp.models import Chapter
146150
147-
class ChapterStackedInline(SortableInlineAdminMixin, admin.StackedInline):
151+
class ChapterStackedInline(SortableStackedInline):
148152
model = Chapter
149153
150154
@admin.register(SortableBook)
@@ -171,7 +175,27 @@ For stacked inlines, the editor for the book's detail view looks like:
171175
:width: 800
172176
:alt: Stacked Inline View
173177

174-
If we instead use the tabluar inline class, then the editor for the book's detail view looks like:
178+
.. note:: Since version 2.1, two buttons have been added to the draggable area above each inline
179+
form. They serve to move that edited item to the begin or end of the list of inlines.
180+
181+
If we instead want to use the tabluar inline class, then modify the code from above to
182+
183+
.. code-block:: python
184+
185+
...
186+
from adminsortable2.admin import SortableTabularInline
187+
188+
from myapp.models import Chapter
189+
190+
class ChapterTabularInline(SortableTabularInline):
191+
model = Chapter
192+
193+
@admin.register(SortableBook)
194+
class SortableBookAdmin(SortableAdminMixin, admin.ModelAdmin):
195+
...
196+
inlines = [ChapterTabularInline]
197+
198+
the editor for the book's detail view then looks like:
175199

176200
.. image:: _static/tabular-inline-view.png
177201
:width: 800

0 commit comments

Comments
 (0)