4

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!

joeskru
  • 242
  • 3
  • 16
  • 1
    I have used this module successfully in the past and my admin classes inherited only from ImportExportModelAdmin. Maybe the multiple inheritance is messing it up? Don't know how the order matters but ImportExportModelAdmin should be the last if it cannot be the only one. admin.ModelAdmin might be trampling with precedence the methods in ImportExport. – Mondongo Jan 14 '16 at 14:36
  • thanks for the reply, yeh i did think of that. if i inherit it last i get this error: "TypeError: Cannot create a consistent method resolution order (MRO) for bases object, ImportExportModelAdmin, ModelAdmin." But saying that, if i only inherit ImportExportModelAdmin I still get nothing coming through. – joeskru Jan 14 '16 at 16:03
  • 1
    What kind of outcome are you waiting for? For buttons to appear? If so, then maybe you've overrided the admin templates so they can't pick up the `import-export` things. – Alex Morozov Jan 14 '16 at 17:25

1 Answers1

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.

bmihelac
  • 6,233
  • 34
  • 45
  • Thanks, still no luck. got a new error: AttributeError: type object 'EmailGroupAdmin' has no attribute 'check', but at a complete loss with this, can't get anything to happen.. tried every combination. one thing i don't understand is where are the templates meant to be? do i need to copy them into my templates directory? – joeskru Jan 15 '16 at 18:43
  • Working! not sure why or how but it does now. – joeskru Jan 15 '16 at 22:46
  • 2
    I wish you would have posted your working code as I'm experiencing a similar issue. – Patrick Mar 24 '16 at 02:58
  • i have gone through so many solutions but neither worked. still struggling with the same issue. – Jahanzeb Nawaz Jan 05 '21 at 19:50