You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have tried creating a doubly-nested sorted inline admin using:
from django.contrib import admin
from translated_fields import TranslatedFieldAdmin
from nested_admin import NestedStackedInline
from adminsortable2.admin import SortableInlineAdminMixin
class LineInline(TranslatedFieldAdmin, SortableInlineAdminMixin, NestedTabularInline):
model = Line
extra = 0
class StanzaInline(TranslatedFieldAdmin, SortableInlineAdminMixin, NestedTabularInline):
model = Stanza
inlines = [
LineInline,
]
extra = 0
@admin.register(Poem)
class PoemAdmin(TranslatedFieldAdmin, NestedModelAdmin):
inlines = [
StanzaInline,
]
adminsortable2 throws an ImproperlyConfigured error (and rightfully so):
Class poems.admin.<class 'poems.admin.StanzaInline'> must also derive from admin.TabularInline or admin.StackedInline
nested_admin derives NestedTabularInline from InlineModelAdmin as can be seen here.
It appears that inheriting both the django and nested_admin classes prevents the adminsortable2 exception, but this breaks the nested admin inlines in the admin page:
class LineInline(TranslatedFieldAdmin, SortableInlineAdminMixin, NestedTabularInline, admin.TabularInline):
...
class StanzaInline(TranslatedFieldAdmin, SortableInlineAdminMixin, NestedTabularInline, admin.TabularInline):
Figuring out exactly how to work around this is way above my experience and skill, but I am very eager to assist in any way I can.
I never worked with django-nested-admin, so I can't really drill down on the problem.
Here is my hint on how to solve it: If you somehow can find out if your for is a NestedTabularInline, than I assume that you have to provide a special template for it. Use that template as a starting point with the additional sortable features and return it in https://github.com/jrief/django-admin-sortable2/blob/master/adminsortable2/admin.py#L571
If you want me to implement this as a sponsored feature, please contact me on my private email address.
I have tried creating a doubly-nested sorted inline admin using:
adminsortable2 throws an
ImproperlyConfigured
error (and rightfully so):nested_admin derives
NestedTabularInline
fromInlineModelAdmin
as can be seen here.It appears that inheriting both the django and nested_admin classes prevents the
adminsortable2
exception, but this breaks the nested admin inlines in the admin page:Figuring out exactly how to work around this is way above my experience and skill, but I am very eager to assist in any way I can.
Is there a way to get the django-nested-admin and django-admin-sortable2 plugins to work together?
I'm using:
The text was updated successfully, but these errors were encountered: