[Django] #29578: Django 2.1b and 2.1rc1 put thousand separator in _selected_action field containing id

59 views
Skip to first unread message

Django

unread,
Jul 19, 2018, 4:22:50 AM7/19/18
to django-...@googlegroups.com
#29578: Django 2.1b and 2.1rc1 put thousand separator in _selected_action field
containing id
-------------------------------------------+------------------------
Reporter: Sassan Haradji | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 2.1
Severity: Release blocker | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------------+------------------------
In django 2.1b and 2.1rc1 when I select an item with id 1600 in item list
in django admin and try to delete the item, when I confirm the deletion
django raises this error:

{{{
...
File "/opt/escape/lib/python3.5/site-
packages/django/contrib/admin/sites.py", line 223, in inner
return view(request, *args, **kwargs)
File "/opt/escape/lib/python3.5/site-
packages/django/utils/decorators.py", line 45, in _wrapper
return bound_method(*args, **kwargs)
File "/opt/escape/lib/python3.5/site-
packages/django/utils/decorators.py", line 142, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/opt/escape/lib/python3.5/site-
packages/django/contrib/admin/options.py", line 1727, in changelist_view
response = self.response_action(request,
queryset=cl.get_queryset(request))
File "/opt/escape/lib/python3.5/site-
packages/django/contrib/admin/options.py", line 1409, in response_action
queryset = queryset.filter(pk__in=selected)
File "/opt/escape/lib/python3.5/site-
packages/django/db/models/query.py", line 841, in filter
return self._filter_or_exclude(False, *args, **kwargs)
File "/opt/escape/lib/python3.5/site-
packages/django/db/models/query.py", line 859, in _filter_or_exclude
clone.query.add_q(Q(*args, **kwargs))
File "/opt/escape/lib/python3.5/site-
packages/django/db/models/sql/query.py", line 1263, in add_q
clause, _ = self._add_q(q_object, self.used_aliases)
File "/opt/escape/lib/python3.5/site-
packages/django/db/models/sql/query.py", line 1287, in _add_q
split_subq=split_subq,
File "/opt/escape/lib/python3.5/site-
packages/django/db/models/sql/query.py", line 1225, in build_filter
condition = self.build_lookup(lookups, col, value)
File "/opt/escape/lib/python3.5/site-
packages/django/db/models/sql/query.py", line 1096, in build_lookup
lookup = lookup_class(lhs, rhs)
File "/opt/escape/lib/python3.5/site-
packages/django/db/models/lookups.py", line 20, in __init__
self.rhs = self.get_prep_lookup()
File "/opt/escape/lib/python3.5/site-
packages/django/db/models/lookups.py", line 210, in get_prep_lookup
rhs_value = self.lhs.output_field.get_prep_value(rhs_value)
File "/opt/escape/lib/python3.5/site-
packages/django/db/models/fields/__init__.py", line 965, in get_prep_value
return int(value)
ValueError: invalid literal for int() with base 10: '1٫600'
}}}

The character `٫` is my persian thousand separator.

--
Ticket URL: <https://code.djangoproject.com/ticket/29578>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 19, 2018, 6:08:51 AM7/19/18
to django-...@googlegroups.com
#29578: Django 2.1b and 2.1rc1 put thousand separator in _selected_action field
containing id
---------------------------------+--------------------------------------

Reporter: Sassan Haradji | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 2.1
Severity: Release blocker | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------

Comment (by Carlton Gibson):

Hi Sassan,

Thanks for the report.

Could you possibly try to bisect the error to see where it was introduced
or create a test case or minimal project demonstrating this so that we can
do so?

--
Ticket URL: <https://code.djangoproject.com/ticket/29578#comment:1>

Django

unread,
Jul 19, 2018, 6:23:23 AM7/19/18
to django-...@googlegroups.com
#29578: Django 2.1b and 2.1rc1 put thousand separator in _selected_action field
containing id
---------------------------------+--------------------------------------

Reporter: Sassan Haradji | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 2.1
Severity: Release blocker | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------

Comment (by Sassan Haradji):

While I'd love to help with the bisect unfortunately I have zero free time
these days. It should happen for you if you have these lines in your
settings:
{{{
LANGUAGE_CODE = 'fa'
locale.setlocale(locale.LC_ALL, 'fa_IR')
LANGUAGES = (
('fa', 'Farsi'),
)
USE_I18N = True
USE_L10N = True
USE_THOUSAND_SEPARATOR = True
THOUSAND_SEPARATOR = '٫'
NUMBER_GROUPING = 3
}}}
And you're using django 2.1rc1 and you try to remvoe an object with id
>=1000 in django admin list.
It should be the minimal requirements to reproduce the issue but I doubt
it has anything to do with persian langauge and it should happen in other
locales too.
If you weren't able to reproduce the issue just tell me here and I'll try
to find some time to do the bisect.

--
Ticket URL: <https://code.djangoproject.com/ticket/29578#comment:2>

Django

unread,
Jul 19, 2018, 6:49:00 AM7/19/18
to django-...@googlegroups.com
#29578: Django 2.1b and 2.1rc1 put thousand separator in _selected_action field
containing id
---------------------------------+------------------------------------

Reporter: Sassan Haradji | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 2.1
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by Carlton Gibson):

* stage: Unreviewed => Accepted


Comment:

OK. I can reproduce. Bisected to 1b7780ea0802116eeef80b398a0432ac3f0ba9ef.

Thanks!

--
Ticket URL: <https://code.djangoproject.com/ticket/29578#comment:3>

Django

unread,
Jul 19, 2018, 1:18:26 PM7/19/18
to django-...@googlegroups.com
#29578: Django 2.1b and 2.1rc1 put thousand separator in _selected_action field
containing id
---------------------------------+------------------------------------

Reporter: Sassan Haradji | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 2.1
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

Comment (by Claude Paroz):

Weird, as the behavior is tested in
https://github.com/django/django/blob/1ed8527e3df930ae54ef237e77f1a53faa0ff5ed/tests/admin_views/test_actions.py#L76

--
Ticket URL: <https://code.djangoproject.com/ticket/29578#comment:4>

Django

unread,
Jul 19, 2018, 2:10:50 PM7/19/18
to django-...@googlegroups.com
#29578: Django 2.1b and 2.1rc1 put thousand separator in _selected_action field
containing id
---------------------------------+----------------------------------------
Reporter: Sassan Haradji | Owner: Claude Paroz
Type: Bug | Status: assigned
Component: contrib.admin | Version: 2.1

Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+----------------------------------------
Changes (by Claude Paroz):

* status: new => assigned
* owner: nobody => Claude Paroz


Comment:

OK, the key to reproduce is to set `NUMBER_GROUPING`. My findings is that
the faulty commit just revealed another bug in `numberformat.format()` not
honoring forced l10n usage.

--
Ticket URL: <https://code.djangoproject.com/ticket/29578#comment:5>

Django

unread,
Jul 19, 2018, 2:32:46 PM7/19/18
to django-...@googlegroups.com
#29578: Django 2.1b and 2.1rc1 put thousand separator in _selected_action field
containing id
---------------------------------+----------------------------------------
Reporter: Sassan Haradji | Owner: Claude Paroz
Type: Bug | Status: assigned
Component: contrib.admin | Version: 2.1

Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+----------------------------------------
Changes (by Claude Paroz):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/10202 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/29578#comment:6>

Django

unread,
Jul 19, 2018, 3:55:17 PM7/19/18
to django-...@googlegroups.com
#29578: Django 2.1b and 2.1rc1 put thousand separator in _selected_action field
containing id
-------------------------------------+-------------------------------------

Reporter: Sassan Haradji | Owner: Claude
| Paroz
Type: Bug | Status: assigned
Component: contrib.admin | Version: 2.1
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/29578#comment:7>

Django

unread,
Jul 19, 2018, 4:45:01 PM7/19/18
to django-...@googlegroups.com
#29578: Django 2.1b and 2.1rc1 put thousand separator in _selected_action field
containing id
-------------------------------------+-------------------------------------
Reporter: Sassan Haradji | Owner: Claude
| Paroz
Type: Bug | Status: closed
Component: contrib.admin | Version: 2.1
Severity: Release blocker | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"0adfba968e28cfb4e4d681e658866debbbd68089" 0adfba96]:
{{{
#!CommitTicketReference repository=""
revision="0adfba968e28cfb4e4d681e658866debbbd68089"
Fixed #29578 -- Made numberformat.format() honor forced l10n usage.

Thanks Sassan Haradji for the report.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29578#comment:8>

Django

unread,
Jul 19, 2018, 4:49:02 PM7/19/18
to django-...@googlegroups.com
#29578: Django 2.1b and 2.1rc1 put thousand separator in _selected_action field
containing id
-------------------------------------+-------------------------------------
Reporter: Sassan Haradji | Owner: Claude
| Paroz
Type: Bug | Status: closed
Component: contrib.admin | Version: 2.1

Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Sassan Haradji):

Great, thanks.

--
Ticket URL: <https://code.djangoproject.com/ticket/29578#comment:9>

Django

unread,
Jul 19, 2018, 4:50:35 PM7/19/18
to django-...@googlegroups.com
#29578: Django 2.1b and 2.1rc1 put thousand separator in _selected_action field
containing id
-------------------------------------+-------------------------------------
Reporter: Sassan Haradji | Owner: Claude
| Paroz
Type: Bug | Status: closed
Component: contrib.admin | Version: 2.1

Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"1084bcc4b78c0a5810a53a32c9678c3563380c9e" 1084bcc4]:
{{{
#!CommitTicketReference repository=""
revision="1084bcc4b78c0a5810a53a32c9678c3563380c9e"
[2.1.x] Fixed #29578 -- Made numberformat.format() honor forced l10n
usage.

Thanks Sassan Haradji for the report.

Backport of 0adfba968e28cfb4e4d681e658866debbbd68089 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29578#comment:10>

Reply all
Reply to author
Forward
0 new messages