Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#14895 closed (fixed)

USE_THOUSAND_SEPARATOR causes error on group admin operations

Reported by: Vlada Macek Owned by: nobody
Component: contrib.admin Version: dev
Severity: Keywords: l10n localization thousands
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Line in django/contrib/admin/templates/admin/delete_selected_confirmation.html:

    <input type="hidden" name="{{ action_checkbox_name }}" value="{{ obj.pk }}" />

obj.pk is rendered with thousands separated (if such localization is enabled), results in exception like

    ValueError: invalid literal for int() with base 10: '1 307'

on submit.

Attachments (3)

14895_delete_confirmation_1000_separator.diff (776 bytes ) - added by Julien Phalip 14 years ago.
14895_delete_confirmation_1000_separator_plus_tests.diff (2.5 KB ) - added by Julien Phalip 14 years ago.
14895_delete_confirmation_1000_separator_unlocalize.diff (2.7 KB ) - added by Julien Phalip 14 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 by Julien Phalip, 14 years ago

Has patch: set
milestone: 1.3
Triage Stage: UnreviewedAccepted

I can confirm this bug. Formatting the pk as a string resolves the issue (see patch attached).

comment:2 by Julien Phalip, 14 years ago

Triage Stage: AcceptedReady for checkin

In this patch, the stringformat template filter forces the id to be rendered without USE_THOUSAND_SEPARATOR getting in the way. I'm not sure whether it is the most elegant solution though, so you might have a better fix to suggest.

Cheekily RFC'ing so it gets a core dev's attention for 1.3 ;)

comment:3 by Russell Keith-Magee, 14 years ago

Triage Stage: Ready for checkinAccepted

This sort of problem is the exact reason that we introduced the unlocalize filter. I suspect that this patch is actually pretty close to being RFC, mod that little detail.

comment:4 by Julien Phalip, 14 years ago

Triage Stage: AcceptedReady for checkin

Thanks for the suggestion, Russell. This feels much cleaner! :)

comment:5 by Russell Keith-Magee, 14 years ago

Resolution: fixed
Status: newclosed

In [15435]:

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.

comment:6 by Jacob, 13 years ago

milestone: 1.3

Milestone 1.3 deleted

Note: See TracTickets for help on using tickets.
Back to Top