Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Fixed #2524 -- Added i18n hooks in create_update generic views. Thank…


git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent e5bf574 commit a8705cec47b164d8e0a3b809d4be442647c56cc2 @adrianholovaty adrianholovaty committed
Showing with 4 additions and 3 deletions.
  1. +4 −3 django/views/generic/
7 django/views/generic/
@@ -6,6 +6,7 @@
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 =
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 =
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':
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)
if not template_name:

0 comments on commit a8705ce

Please sign in to comment.
Something went wrong with that request. Please try again.