Hatim
Hatim

Reputation: 1522

How to import Wagtail ModelAdmin index page into a template

I created a new AdminModel as follows:


class OneModelAdmin(MyModelAdmin):
    model = SomeModel
    menu_label = 'One'
    edit_view_class = OneEditView
    edit_template_name = '.../one-edit.html'
    index_view_class = OneIndexView
    index_template_name = '...'

class TwoModelAdmin(MyModelAdmin):
    model = SomeOtherModel
    menu_label = 'Two'
    edit_view_class = TwoEditView
    edit_template_name = '.../two-edit.html'
    index_view_class = TwoIndexView
    index_template_name = '...'

How can I import the TwoModelAdmin index view inside the OneModelAdmin edit template?

Edit:

from wagtail.contrib.modeladmin.options import ModelAdmin
from wagtail.contrib.modeladmin.views import IndexView

class MyModelAdmin(ModelAdmin):
    list_per_page = 50
    index_view_class = IndexView
    edit_view_class = MyEditView
    create_view_class = MyCreateView
    button_helper_class = MyButtonHelper
    allowed_lookup = []

Upvotes: 0

Views: 175

Answers (0)

Related Questions