mirror of
https://github.com/django/django.git
synced 2024-12-25 10:35:48 +00:00
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
This commit is contained in:
parent
1291888153
commit
5582ad149c
@ -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" />
|
||||
|
@ -1675,6 +1675,29 @@ class AdminActionsTest(TestCase):
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user