django-modeltranslation icon indicating copy to clipboard operation
django-modeltranslation copied to clipboard

values qs manager KeyError

Open rombr opened this issue 9 years ago • 2 comments

Hello!

Django==1.7.11 django-modeltranslation==0.10.2

When I use qs.values(...) for some fields I get KeyError at: https://github.com/deschler/django-modeltranslation/blob/0.10.2/modeltranslation/manager.py#L434 when do for obj in qs.values(...):

rombr avatar Dec 15 '15 20:12 rombr

Can you please provide more info, a minimal model with translation that's causin a problem?

zlorf avatar Dec 15 '15 20:12 zlorf

Problem was in second call of same qs, for now .nocache() helped me.

class ContactModel(models.Model):
    address = models.TextField()


class ContactModelTranslationOptions(TranslationOptions):
    fields = 'address',


translator.register(ContactModel, ContactModelTranslationOptions)


qs = ContactModel.objects.values('address')

rombr avatar Dec 15 '15 20:12 rombr