[Django]-Is it possible to use query parameters on the Django Admin Site

0👍

Was just working on the same problem.

Problem is that django admin catches any uknown(unregistered via some filter on admin view) query params and if any found raises exception which redirects

Solution is to call something like that inside middleware:

def extract_client_id_from_admin_api_url(request):
    request.GET._mutable = True
    client_id = request.GET.pop('client_id', None)
    request.GET._mutable = False
    return client_id[0] if client_id else None

So that your query parameter is uknown to django admin site(removed before request reaches admin views). Please note, that this middleware should be on top of middleware list in settings.

This is dirty, and hacky. Though i didn’t find better solution yet.

Leave a comment