Fixed #10600 -- Allow for format marker reordering in a translatable string.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10141 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2009-03-24 08:22:23 +00:00
parent 37f25d4c0c
commit 2dfdc2b01b
1 changed files with 13 additions and 13 deletions

View File

@ -457,11 +457,11 @@ class ModelAdmin(BaseModelAdmin):
def delete_selected(self, request, queryset): def delete_selected(self, request, queryset):
""" """
Default action which deletes the selected objects. Default action which deletes the selected objects.
In the first step, it displays a confirmation page whichs shows all In the first step, it displays a confirmation page whichs shows all
the deleteable objects or, if the user has no permission one of the the deleteable objects or, if the user has no permission one of the
related childs (foreignkeys) it displays a "permission denied" message. related childs (foreignkeys) it displays a "permission denied" message.
In the second step delete all selected objects and display the change In the second step delete all selected objects and display the change
list again. list again.
""" """
@ -474,7 +474,7 @@ class ModelAdmin(BaseModelAdmin):
# Populate deletable_objects, a data structure of all related objects that # Populate deletable_objects, a data structure of all related objects that
# will also be deleted. # will also be deleted.
# deletable_objects must be a list if we want to use '|unordered_list' in the template # deletable_objects must be a list if we want to use '|unordered_list' in the template
deletable_objects = [] deletable_objects = []
perms_needed = set() perms_needed = set()
@ -495,9 +495,9 @@ class ModelAdmin(BaseModelAdmin):
obj_display = force_unicode(obj) obj_display = force_unicode(obj)
self.log_deletion(request, obj, obj_display) self.log_deletion(request, obj, obj_display)
queryset.delete() queryset.delete()
self.message_user(request, _("Successfully deleted %d %s.") % ( self.message_user(request, _("Successfully deleted %(count)d %(items)s.") % {
n, model_ngettext(self.opts, n) "count": n, "items": model_ngettext(self.opts, n)
)) })
# Return None to display the change list page again. # Return None to display the change list page again.
return None return None
@ -512,7 +512,7 @@ class ModelAdmin(BaseModelAdmin):
"app_label": app_label, "app_label": app_label,
'action_checkbox_name': helpers.ACTION_CHECKBOX_NAME, 'action_checkbox_name': helpers.ACTION_CHECKBOX_NAME,
} }
# Display the confirmation page # Display the confirmation page
return render_to_response(self.delete_confirmation_template or [ return render_to_response(self.delete_confirmation_template or [
"admin/%s/%s/delete_selected_confirmation.html" % (app_label, opts.object_name.lower()), "admin/%s/%s/delete_selected_confirmation.html" % (app_label, opts.object_name.lower()),
@ -685,15 +685,15 @@ class ModelAdmin(BaseModelAdmin):
if action_form.is_valid(): if action_form.is_valid():
action = action_form.cleaned_data['action'] action = action_form.cleaned_data['action']
func, name, description = self.get_actions(request)[action] func, name, description = self.get_actions(request)[action]
# Get the list of selected PKs. If nothing's selected, we can't # Get the list of selected PKs. If nothing's selected, we can't
# perform an action on it, so bail. # perform an action on it, so bail.
selected = request.POST.getlist(helpers.ACTION_CHECKBOX_NAME) selected = request.POST.getlist(helpers.ACTION_CHECKBOX_NAME)
if not selected: if not selected:
return None return None
response = func(request, queryset.filter(pk__in=selected)) response = func(request, queryset.filter(pk__in=selected))
# Actions may return an HttpResponse, which will be used as the # Actions may return an HttpResponse, which will be used as the
# response from the POST. If not, we'll be a good little HTTP # response from the POST. If not, we'll be a good little HTTP
# citizen and redirect back to the changelist page. # citizen and redirect back to the changelist page.
@ -901,7 +901,7 @@ class ModelAdmin(BaseModelAdmin):
response = self.response_action(request, queryset=cl.get_query_set()) response = self.response_action(request, queryset=cl.get_query_set())
if response: if response:
return response return response
# If we're allowing changelist editing, we need to construct a formset # If we're allowing changelist editing, we need to construct a formset
# for the changelist given all the fields to be edited. Then we'll # for the changelist given all the fields to be edited. Then we'll
# use the formset to validate/process POSTed data. # use the formset to validate/process POSTed data.
@ -946,10 +946,10 @@ class ModelAdmin(BaseModelAdmin):
media = self.media + formset.media media = self.media + formset.media
else: else:
media = self.media media = self.media
# Build the action form and populate it with available actions. # Build the action form and populate it with available actions.
action_form = self.action_form(auto_id=None) action_form = self.action_form(auto_id=None)
action_form.fields['action'].choices = self.get_action_choices(request) action_form.fields['action'].choices = self.get_action_choices(request)
context = { context = {
'title': cl.title, 'title': cl.title,