Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#14895 closed (fixed)

USE_THOUSAND_SEPARATOR causes error on group admin operations

Reported by: Tuttle Owned by: nobody
Component: contrib.admin Version: master
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: UI/UX:


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

    <input type="hidden" name="{{ action_checkbox_name }}" value="{{ }}" /> 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 Changed 6 years ago by julien

  • Has patch set
  • milestone set to 1.3
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

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

comment:2 Changed 6 years ago by julien

  • Triage Stage changed from Accepted to 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 Changed 6 years ago by russellm

  • Triage Stage changed from Ready for checkin to 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.

comment:4 Changed 6 years ago by julien

  • Triage Stage changed from Accepted to Ready for checkin

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

comment:5 Changed 6 years ago by russellm

  • Resolution set to fixed
  • Status changed from new to closed

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 Changed 5 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

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