geex-arts / django-jet

Modern responsive template for the Django admin interface with improved functionality. We are proud to announce completely new Jet. Please check out Live Demo
https://github.com/jet-admin/jet-bridge
GNU Affero General Public License v3.0
3.58k stars 775 forks source link

JET_CHANGE_FORM_SIBLING_LINKS not filtering the queryset based on preserved_filters #275

Open sandro-salles opened 6 years ago

sandro-salles commented 6 years ago

Guys,

I've found that the sibling navigation is currently ignoring preserved_filters when the _changelist_filters are present in the request.GET QueryDict.

apparently the try/except block at line 219 of jet/utils.py always raises a IncorrectLookupParameters exception saying IncorrectLookupParameters: MODEL has no field named u'_changelist_filters.

I managed to "solve" this issue with a workaround by monkey patching get_model_queryset and mutating the request.GET QueryDict before reaching the exception as follows:

if not request.GET._mutable:
    request.GET._mutable = True

request.GET = QueryDict(changelist_filters)

I know, probably not the best approach :/ But at least the thing is working for now.

It would be nice if you could take a look into this!

By the way, i'm using Django Jet version 1.0.6 / Django 1.9.7 / Python 2.7.2

Thanks Sandro Salles

souzagilson15 commented 4 years ago

This problem has not yet been solved.

Thanks Sandro!