Ticket #14529: 14529.1.diff

File 14529.1.diff, 1.5 KB (added by Ramiro Morales, 14 years ago)

Another similar patch but with reduced impact.

  • django/contrib/admin/options.py

    diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
    a b  
    748748        Determines the HttpResponse for the change_view stage.
    749749        """
    750750        opts = obj._meta
     751
     752        # handle proxy models automatically created by .only() or .defer()
     753        verbose_name = opts.verbose_name
     754        if obj._deferred:
     755            opts_ = opts.proxy_for_model._meta
     756            verbose_name = opts_.verbose_name
     757
    751758        pk_value = obj._get_pk_val()
    752759
    753         msg = _('The %(name)s "%(obj)s" was changed successfully.') % {'name': force_unicode(opts.verbose_name), 'obj': force_unicode(obj)}
     760        msg = _('The %(name)s "%(obj)s" was changed successfully.') % {'name': force_unicode(verbose_name), 'obj': force_unicode(obj)}
    754761        if "_continue" in request.POST:
    755762            self.message_user(request, msg + ' ' + _("You may edit it again below."))
    756763            if "_popup" in request.REQUEST:
     
    762769            self.message_user(request, msg)
    763770            return HttpResponseRedirect("../%s/" % pk_value)
    764771        elif "_addanother" in request.POST:
    765             self.message_user(request, msg + ' ' + (_("You may add another %s below.") % force_unicode(opts.verbose_name)))
     772            self.message_user(request, msg + ' ' + (_("You may add another %s below.") % force_unicode(verbose_name)))
    766773            return HttpResponseRedirect("../add/")
    767774        else:
    768775            self.message_user(request, msg)
Back to Top