Django Fix "AttributeError: This QueryDict instance is immutable"

Fix the Django error: "AttributeError: This QueryDict instance is immutable".

from django.contrib.admin.sites import AdminSite
 
def my_view(request):
    admin_site = admin.MyModelAdmin(models.MyModel, AdminSite())
    request.GET._mutable = True
    request.GET['_popup'] = '1'
    request.GET._mutable = False
    return admin_site.add_view(request)
Did this help you? Please let me know with a comment. Thank you
Posted .

Comments (RSS)

Leave a comment