Ticket #2986: remove_newlines.diff

File remove_newlines.diff, 1.3 KB (added by Sean Brant, 15 years ago)

just removes newlines forcing everything into one long string.

  • django/contrib/admin/options.py

     
    1818from django.utils.html import escape
    1919from django.utils.safestring import mark_safe
    2020from django.utils.functional import curry
    21 from django.utils.text import capfirst, get_text_list
     21from django.utils.text import capfirst, get_text_list, normalize_newlines
    2222from django.utils.translation import ugettext as _
    2323from django.utils.translation import ungettext, ugettext_lazy
    2424from django.utils.encoding import force_unicode
     
    644644        if request.POST.has_key("_popup"):
    645645            return HttpResponse('<script type="text/javascript">opener.dismissAddAnotherPopup(window, "%s", "%s");</script>' % \
    646646                # escape() calls force_unicode.
    647                 (escape(pk_value), escape(obj)))
     647                # fixes #2986 by just removing newlines forcing everything into one long string.
     648                (escape(pk_value), normalize_newlines(escape(obj)).replace('\n', ' ')))
    648649        elif request.POST.has_key("_addanother"):
    649650            self.message_user(request, msg + ' ' + (_("You may add another %s below.") % force_unicode(opts.verbose_name)))
    650651            return HttpResponseRedirect(request.path)
Back to Top