Skip to content

Commit

Permalink
Fixed #10600 -- Allow for format marker reordering in a translatable …
Browse files Browse the repository at this point in the history
…string.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10141 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
malcolmt committed Mar 24, 2009
1 parent 37f25d4 commit 2dfdc2b
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions django/contrib/admin/options.py
Expand Up @@ -457,11 +457,11 @@ def get_action(self, action):
def delete_selected(self, request, queryset):
"""
Default action which deletes the selected objects.
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
related childs (foreignkeys) it displays a "permission denied" message.
In the second step delete all selected objects and display the change
list again.
"""
Expand All @@ -474,7 +474,7 @@ def delete_selected(self, request, queryset):

# Populate deletable_objects, a data structure of all related objects that
# will also be deleted.

# deletable_objects must be a list if we want to use '|unordered_list' in the template
deletable_objects = []
perms_needed = set()
Expand All @@ -495,9 +495,9 @@ def delete_selected(self, request, queryset):
obj_display = force_unicode(obj)
self.log_deletion(request, obj, obj_display)
queryset.delete()
self.message_user(request, _("Successfully deleted %d %s.") % (
n, model_ngettext(self.opts, n)
))
self.message_user(request, _("Successfully deleted %(count)d %(items)s.") % {
"count": n, "items": model_ngettext(self.opts, n)
})
# Return None to display the change list page again.
return None

Expand All @@ -512,7 +512,7 @@ def delete_selected(self, request, queryset):
"app_label": app_label,
'action_checkbox_name': helpers.ACTION_CHECKBOX_NAME,
}

# Display the confirmation page
return render_to_response(self.delete_confirmation_template or [
"admin/%s/%s/delete_selected_confirmation.html" % (app_label, opts.object_name.lower()),
Expand Down Expand Up @@ -685,15 +685,15 @@ def response_action(self, request, queryset):
if action_form.is_valid():
action = action_form.cleaned_data['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.
selected = request.POST.getlist(helpers.ACTION_CHECKBOX_NAME)
if not selected:
return None

response = func(request, queryset.filter(pk__in=selected))

# Actions may return an HttpResponse, which will be used as the
# response from the POST. If not, we'll be a good little HTTP
# citizen and redirect back to the changelist page.
Expand Down Expand Up @@ -901,7 +901,7 @@ def changelist_view(self, request, extra_context=None):
response = self.response_action(request, queryset=cl.get_query_set())
if response:
return response

# 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
# use the formset to validate/process POSTed data.
Expand Down Expand Up @@ -946,10 +946,10 @@ def changelist_view(self, request, extra_context=None):
media = self.media + formset.media
else:
media = self.media

# Build the action form and populate it with available actions.
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 = {
'title': cl.title,
Expand Down

0 comments on commit 2dfdc2b

Please sign in to comment.