Ticket #1092: admin_form_defaults_via_GET.patch

File admin_form_defaults_via_GET.patch, 882 bytes (added by plisk, 19 years ago)
  • django/contrib/admin/views/main.py

     
    429432        # Add default data.
    430433        new_data = manipulator.flatten_data()
    431434
    432         # Override the defaults with request.GET, if it exists.
    433         new_data.update(request.GET)
     435        # Override the defaults with GET params, if they exist.
     436        get_lists = request.GET.lists()
     437        get_params = {}
     438        for param_tuple in get_lists:
     439            if len(param_tuple[1]) == 1:
     440                get_params[param_tuple[0]] = param_tuple[1][0]
     441            else:
     442                get_params[param_tuple[0]] = param_tuple[1]
     443
     444        new_data.update(get_params)
     445       
    434446        errors = {}
    435447
    436448    # Populate the FormWrapper.
Back to Top