diff --git a/django/views/generic/create_update.py b/django/views/generic/create_update.py index 27ba327ff56..034253a5491 100644 --- a/django/views/generic/create_update.py +++ b/django/views/generic/create_update.py @@ -6,6 +6,7 @@ from django.contrib.auth.views import redirect_to_login from django.template import RequestContext from django.http import Http404, HttpResponse, HttpResponseRedirect from django.core.exceptions import ObjectDoesNotExist, ImproperlyConfigured +from django.utils.translation import gettext def create_object(request, model, template_name=None, template_loader=loader, extra_context=None, post_save_redirect=None, @@ -39,7 +40,7 @@ def create_object(request, model, template_name=None, new_object = manipulator.save(new_data) if request.user.is_authenticated(): - request.user.message_set.create(message="The %s was created successfully." % model._meta.verbose_name) + request.user.message_set.create(message=gettext("The %(verbose_name)s was created successfully.") % {"verbose_name": model._meta.verbose_name}) # Redirect to the new object: first by trying post_save_redirect, # then by obj.get_absolute_url; fail if neither works. @@ -113,7 +114,7 @@ def update_object(request, model, object_id=None, slug=None, object = manipulator.save(new_data) if request.user.is_authenticated(): - request.user.message_set.create(message="The %s was updated successfully." % model._meta.verbose_name) + request.user.message_set.create(message=gettext("The %(verbose_name)s was updated successfully.") % {"verbose_name": model._meta.verbose_name}) # Do a post-after-redirect so that reload works, etc. if post_save_redirect: @@ -180,7 +181,7 @@ def delete_object(request, model, post_delete_redirect, if request.method == 'POST': object.delete() if request.user.is_authenticated(): - request.user.message_set.create(message="The %s was deleted." % model._meta.verbose_name) + request.user.message_set.create(message=gettext("The %(verbose_name)s was deleted.") % {"verbose_name": model._meta.verbose_name}) return HttpResponseRedirect(post_delete_redirect) else: if not template_name: