Ticket #13883: options.py.diff

File options.py.diff, 1.1 KB (added by SardarNL, 14 years ago)

Django 1.2.4 patch, let admin recognize groups in selects

  • django/contrib/admin/options.py

     
    676676            return HttpResponseRedirect(post_url_continue % pk_value)
    677677
    678678        if request.POST.has_key("_popup"):
    679             return HttpResponse('<script type="text/javascript">opener.dismissAddAnotherPopup(window, "%s", "%s");</script>' % \
     679            if hasattr(self, 'list_grouping') and self.list_grouping:
     680                grp = escape(getattr(obj, self.list_grouping))
     681            else:
     682                grp = ''
     683            return HttpResponse('<script type="text/javascript">opener.dismissAddAnotherPopup(window, "%s", "%s", "%s");</script>' % \
    680684                # escape() calls force_unicode.
    681                 (escape(pk_value), escape(obj)))
     685                (escape(pk_value), escape(obj), grp))
    682686        elif request.POST.has_key("_addanother"):
    683687            self.message_user(request, msg + ' ' + (_("You may add another %s below.") % force_unicode(opts.verbose_name)))
    684688            return HttpResponseRedirect(request.path)
Back to Top