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

get_queryset patching shadows original get_queryset method

Open jtiai opened this issue 9 years ago • 1 comments

When fixing issue #204, a slightly different MRO creation was introduced. This unfortunately doesn't work right on Django 1.5/1.4.

If there exists get_query_set method in a original manager it's patched. But patch is made by using 1.6+ method name get_queryset. This leads to situation where super calls only access get_queryset methods thus completely bypassing original get_query_set

As a workaround by defining "forward compatible" get_queryset = get_query_set method on original manager and system works as expected due proper patching.

Considering that older versions aren't any more supported to I think it would be just enough document this in case someone runs into it.

jtiai avatar Nov 28 '15 14:11 jtiai

Well, we still support Django >= 1.4, so 1.5 and 1.6 should work properly.

I assume your failing scenario looks like this: manager with MRO NewMultilingualManager > MultilingualManager > CustomManager > MultilingualQuerysetManager > Manager, where CustomManager only have get_query_set and not get_queryset, right? In this case this method actually would be ignored...

I wonder if it would be sufficient if we change lookup order (get_query_set before get_queryset) for Django < 1.6?

zlorf avatar Jan 23 '16 12:01 zlorf