Ticket #5704: 5704-r16357.diff

File 5704-r16357.diff, 1.9 KB (added by dArignac, 4 years ago)
  • django/contrib/admin/media/js/admin/RelatedObjectLookups.js

     
    7474    var name = windowname_to_id(win.name);
    7575    var elem = document.getElementById(name);
    7676    if (elem) {
    77         if (elem.nodeName == 'SELECT') {
     77        var elemName = elem.nodeName.toUpperCase();
     78        if (elemName == 'SELECT') {
    7879            var o = new Option(newRepr, newId);
    7980            elem.options[elem.options.length] = o;
    8081            o.selected = true;
    81         } else if (elem.nodeName == 'INPUT') {
     82        } else if (elemName == 'INPUT') {
    8283            if (elem.className.indexOf('vManyToManyRawIdAdminField') != -1 && elem.value) {
    8384                elem.value += ',' + newId;
    8485            } else {
  • django/contrib/admin/options.py

     
    738738            return HttpResponseRedirect(post_url_continue % pk_value)
    739739
    740740        if "_popup" in request.POST:
    741             return HttpResponse('<script type="text/javascript">opener.dismissAddAnotherPopup(window, "%s", "%s");</script>' % \
     741            return HttpResponse(
     742                '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
     743                '<html xmlns="http://www.w3.org/1999/xhtml"><head><title></title></head><body>'
     744                '<script type="text/javascript">opener.dismissAddAnotherPopup(window, "%s", "%s");</script></body></html>' % \
    742745                # escape() calls force_unicode.
    743746                (escape(pk_value), escapejs(obj)))
    744747        elif "_addanother" in request.POST:
Back to Top