- marked as blocker
Modeltranslation issue on a model not using it
Issue #28
new
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)
-
repo owner -
Fixed in pending PR https://github.com/neithere/django-autoslug/pull/26
- Log in to comment
Possibly fixed in pending PR https://bitbucket.org/neithere/django-autoslug/pull-request/13/fixed-bug-attributeerror. However, it doesn't contain tests; maybe we could write them based on this issue.