#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)
Change History (9)
comment:1 by , 15 years ago
| Has patch: | set |
|---|---|
| milestone: | → 1.3 |
| Triage Stage: | Unreviewed → Accepted |
by , 15 years ago
| Attachment: | 14895_delete_confirmation_1000_separator.diff added |
|---|
by , 15 years ago
| Attachment: | 14895_delete_confirmation_1000_separator_plus_tests.diff added |
|---|
comment:2 by , 15 years ago
| Triage Stage: | Accepted → Ready 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 , 15 years ago
| Triage Stage: | Ready for checkin → Accepted |
|---|
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.
by , 15 years ago
| Attachment: | 14895_delete_confirmation_1000_separator_unlocalize.diff added |
|---|
comment:4 by , 15 years ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
Thanks for the suggestion, Russell. This feels much cleaner! :)
I can confirm this bug. Formatting the pk as a string resolves the issue (see patch attached).