LPgenerator / django-db-mailer

Django module to easily send emails/sms/tts/push using django templates stored on database and managed through the Django Admin
https://github.com/LPgenerator/django-db-mailer
GNU General Public License v2.0
256 stars 80 forks source link

MRO problem using django-modeltranslation #38

Closed bsvetchine closed 8 years ago

bsvetchine commented 8 years ago

In dbmail/admin.py line 55, the definition of class TranslationModelAdmin causes a method resolution order error.

I am using python 2.7.3, django 1.8.7 and modeltranslation 0.10.2.

TypeError: Error when calling the metaclass bases
    Cannot create a consistent method resolution
order (MRO) for bases ModelAdmin, TabbedDjangoJqueryTranslationAdmin
gotlium commented 8 years ago

@bsvetchine, thanks for report.

@vosi, can you check. because previously you are wrote this code https://github.com/LPgenerator/django-db-mailer/pull/21

gotlium commented 8 years ago

You could not remove ModelAdmin, because django-reversion and django-reversion-compare is a ModelAdmin, if this apps was installed, and when you are using model translation, this apps is should be mix to one. At previous release this Admin mixins not found at admin.py file https://github.com/LPgenerator/django-db-mailer/blob/2ef5d6d5437601bd633d0ef43ed9c5defb67da7b/dbmail/admin.py. I think that we have to find another way to fix this.

bsvetchine commented 8 years ago

@gotlium I updated the Pull request #39 changing TranslationModelAdmin inheritance order. It fixes the MRO problem.

Indeed I use django-reversion and django-reversion-compare in my project and django-db-mailer works without any problem in version 2.2.0.

gotlium commented 8 years ago

@bsvetchine Current version is 2.3. I think your fixes is for current version, not for 2.2.0. You should test 2.3 on your project with your MRO fixes.

bsvetchine commented 8 years ago

Yes indeed my fix is for version 2.3 only. I try to update dbmailer from version 2.2.0 to 2.3 in my project. That's when I face this MRO pb.

bsvetchine commented 8 years ago

And I have no pb using my fix with dbmail in version 2.3 in my project

gotlium commented 8 years ago

So now django-reversion, django-reversion-compare, django-modeltranslation, grappelli-modeltranslation working properly without any problems on your project?

bsvetchine commented 8 years ago

I do not use grappelli-modeltranslation.

But using django-reversion, django-reversion-compare, django-modeltranslation and dbmailer version 2.3 with my fix, it works without any problems.

gotlium commented 8 years ago

I think @skhaylov , @vosi will be check, and after we merge your pull-request and release new version to PyPi.