Modeltranslation issue on a model not using it

Issue #28 new
Former user created an issue

Hello,

I use modeltranslation in a project on certain models. One model on which I use autoslug but do not use modeltranslation causes an issue.

A slug filed defined as

slug = AutoSlugField(populate_from='title')

will have the error 'field title_XX does not exist'

As far as I can tell it is because of the following code https://bitbucket.org/neithere/django-autoslug/src/126fd462e2135e668714d04f4d2fea902ae3c7c7/autoslug/fields.py?at=default#cl-279

if 'modeltranslation' in settings.INSTALLED_APPS and not hasattr(self.populate_from, '__call__'):
            post_save.connect( self.modeltranslation_update_slugs, sender = type(instance) )

If modeltranslation is installed it is used even if the model on which there is a slug does not use modeltranslation.

For now I solved it by using a lambda as it makes the test above fail.

I am not sure how to best solve this, whether by documentation or with a code change.

Comments (2)

  1. Log in to comment