django-import-export can not get it working

て烟熏妆下的殇ゞ 提交于 2019-12-10 15:56:00

问题


Can not get this to do anything, installed, added to apps, followed the docs. nothing. here's my admin.py:

from import_export import resources
from import_export.admin import ImportExportModelAdmin


class EmailGroupResource(resources.ModelResource):
    class Meta:
        model = EmailGroup

class EmailGroupAdmin(DjangoObjectActions, ImportExportModelAdmin, admin.ModelAdmin):
    resource_class = EmailGroupResource
    .. rest of admin 
admin.site.register(EmailGroup, EmailGroupAdmin)

Maybe i have a conflict? using Mezzanine4.0

Please help!


回答1:


If you are already inherit from admin.ModelAdmin, than using mixin would make more sense import_export.admin.ImportExportMixin (see: https://django-import-export.readthedocs.org/en/latest/getting_started.html#admin-integration)

If buttons do not appear, it is possible that DjangoObjectActions overrides admin template.



来源:https://stackoverflow.com/questions/34792159/django-import-export-can-not-get-it-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!