Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #14895 -- Ensure that USE_THOUSAND_SEPARATOR doesn't break the …

…delete confirmation page. Thanks to Tuttle for the report, and Julien Phalip for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15435 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 5582ad149c6f4fcdd0a8dfaf1f22ed0f2bf295b2 1 parent 1291888
@freakboy3742 freakboy3742 authored
View
4 django/contrib/admin/templates/admin/delete_selected_confirmation.html
@@ -1,5 +1,5 @@
{% extends "admin/base_site.html" %}
-{% load i18n %}
+{% load i18n l10n %}
{% block breadcrumbs %}
<div class="breadcrumbs">
@@ -36,7 +36,7 @@
<form action="" method="post">{% csrf_token %}
<div>
{% for obj in queryset %}
- <input type="hidden" name="{{ action_checkbox_name }}" value="{{ obj.pk }}" />
+ <input type="hidden" name="{{ action_checkbox_name }}" value="{{ obj.pk|unlocalize }}" />
{% endfor %}
<input type="hidden" name="action" value="delete_selected" />
<input type="hidden" name="post" value="yes" />
View
23 tests/regressiontests/admin_views/tests.py
@@ -1675,6 +1675,29 @@ def test_model_admin_default_delete_action(self):
response = self.client.post('/test_admin/admin/admin_views/subscriber/', delete_confirmation_data)
self.assertEqual(Subscriber.objects.count(), 0)
+ def test_non_localized_pk(self):
+ """If USE_THOUSAND_SEPARATOR is set, make sure that the ids for
+ the objects selected for deletion are rendered without separators.
+ Refs #14895.
+ """
+ self.old_USE_THOUSAND_SEPARATOR = settings.USE_THOUSAND_SEPARATOR
+ self.old_USE_L10N = settings.USE_L10N
+ settings.USE_THOUSAND_SEPARATOR = True
+ settings.USE_L10N = True
+ subscriber = Subscriber.objects.get(id=1)
+ subscriber.id = 9999
+ subscriber.save()
+ action_data = {
+ ACTION_CHECKBOX_NAME: [9999, 2],
+ 'action' : 'delete_selected',
+ 'index': 0,
+ }
+ response = self.client.post('/test_admin/admin/admin_views/subscriber/', action_data)
+ self.assertTemplateUsed(response, 'admin/delete_selected_confirmation.html')
+ self.assertTrue('value="9999"' in response.content and 'value="2"' in response.content) # Instead of 9,999
+ settings.USE_THOUSAND_SEPARATOR = self.old_USE_THOUSAND_SEPARATOR
+ settings.USE_L10N = self.old_USE_L10N
+
def test_model_admin_default_delete_action_protected(self):
"""
Tests the default delete action defined as a ModelAdmin method in the
Please sign in to comment.
Something went wrong with that request. Please try again.