19 lines
673 B
Python
Executable File
19 lines
673 B
Python
Executable File
from nested_admin.nested import NestedTabularInline
|
|
from polymorphic.admin import (
|
|
PolymorphicParentModelAdmin as BasePolymorphicParentModelAdmin,
|
|
)
|
|
|
|
|
|
class PolymorphicParentModelAdmin(BasePolymorphicParentModelAdmin):
|
|
def get_child_type_choices(self, request, action):
|
|
choices = super().get_child_type_choices(request=request, action=action)
|
|
return tuple((ct_id, label.title()) for (ct_id, label) in choices)
|
|
|
|
|
|
class NestedTabularSingleItemInline(NestedTabularInline):
|
|
template = "nesting/admin/inlines/tabular_single.html"
|
|
|
|
|
|
class NestedStackedSingleItemInline(NestedTabularInline):
|
|
template = "nesting/admin/inlines/stacked_single.html"
|