Как я могу интегрировать Django Import Export и Wagtail? - PullRequest
0 голосов
/ 24 сентября 2019

Я пытаюсь добавить модельный ресурс из django-import-export в админ для Wagtail.Единственная документация, которую я могу найти, говорит, что вы будете делать это через хуки.Проблема в том, что я получаю сообщение об ошибке:

missing 2 required positional arguments: 'model' and 'admin_site'

Все resource и ModelAdmin:

class AccountResource(resources.ModelResource):

    class Meta:
        model = Account
        fields = ('first_name', 'last_name', 'email', 'created', 'archived')

class AccountsAdmin(ImportExportModelAdmin, ModelAdmin):
    resource_class = AccountResource
    model = Account
    menu_label = 'Accounts'  # ditch this to use verbose_name_plural from model
    menu_icon = 'group'  # change as required
    menu_order = 200  # will put in 3rd place (000 being 1st, 100 2nd)
    add_to_settings_menu = False  # or True to add your model to the Settings sub-menu
    exclude_from_explorer = False # or True to exclude pages of this type from Wagtail's explorer view
    list_display = ('first_name', 'last_name', 'email', 'created', 'archived')
    search_fields = ('first_name', 'last_name', 'email', 'created')

# Now you just need to register your customised ModelAdmin class with Wagtail
modeladmin_register(AccountsAdmin)

Есть предложения?

...