@@ -137,14 +137,18 @@ If a model on the same page has a parent model, these are called inlines. Suppos
137137model for chapters and want to edit the chapter together with the book's title using the same
138138editor, 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