mbraak / django-mptt-admin

Django-mptt-admin provides a nice Django Admin interface for Mptt models
https://mbraak.github.io/django-mptt-admin/
Other
294 stars 47 forks source link

Displaying in inline #381

Closed albertalexandrov closed 2 years ago

albertalexandrov commented 2 years ago

Hi and thanks for the Lib!

Could you please give me a hint how to display tree in inline? For example imagine there are two models:

class Constructor(models.Model):
    name = models.CharField(....)

class PerformersTree(models.Model):
    role = models.CharField(....)
    parent = TreeForeignKey('self', on_delete=models.CASCADE, null=True, blank=True, related_name='children')
    constructor = models.ForeignKey(RoleConstructor, on_delete=models.CASCADE, null=True)

and admins:

class PerformersTreeInline(admin.TabularInline):   # not working
    model = PerformersTree
    template = 'django_mptt_admin/change_list.html' 

@admin.register(Constructor)
class RoleConstructorAdmin(admin.ModelAdmin):
    inlines = PerformersTreeInline,

Your lib has functionality I need (buttons "add", "edit") and I'd like to create performers tree inside constructor with this buttons.

mbraak commented 2 years ago

I'm afraid displaying a tree inline is not supported. It looks like a very useful feature, but I don't have plans to implement it at this moment.

albertalexandrov commented 2 years ago

Sure :)