Code

Opened 6 years ago

Closed 6 years ago

Last modified 3 years ago

#8805 closed (fixed)

TypeError: sequence expected, int found

Reported by: anonymous Owned by: nobody
Component: contrib.admin Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

class Brand(models.Model):
...
    geo = models.ForeignKey(Geo,
           related_name='brand_set',
           blank=True,
           null=True,
           limit_choices_to={'level__exact' : 0},
          )
...

Caught an exception while rendering: sequence expected, int found

Original Traceback (most recent call last):

File "/opt/elec-devel/python/django/template/debug.py", line 71, in render_node

result = node.render(context)

File "/opt/elec-devel/python/django/template/debug.py", line 87, in render

output = force_unicode(self.filter_expression.resolve(context))

File "/opt/elec-devel/python/django/utils/encoding.py", line 49, in force_unicode

s = unicode(s)

File "/opt/elec-devel/python/django/forms/forms.py", line 326, in unicode

return self.as_widget()

File "/opt/elec-devel/python/django/forms/forms.py", line 358, in as_widget

return widget.render(name, data, attrs=attrs)

File "/opt/elec-devel/python/django/contrib/admin/widgets.py", line 109, in render

params = self.url_parameters()

File "/opt/elec-devel/python/django/contrib/admin/widgets.py", line 134, in url_parameters

params = self.base_url_parameters()

File "/opt/elec-devel/python/django/contrib/admin/widgets.py", line 129, in base_url_parameters

params.update(dict([(k, ','.join(v)) for k, v in self.rel.limit_choices_to.items()]))

TypeError: sequence expected, int found

Attachments (0)

Change History (5)

comment:1 Changed 6 years ago by anonymous

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

but

limit_choices_to={'status__gte' : 3}

is works.

comment:2 Changed 6 years ago by Elec

admin.py

class BrandAdmin(admin.ModelAdmin):
  raw_id_fields = ('geo',)

comment:3 Changed 6 years ago by brosner

  • milestone set to 1.0

comment:4 Changed 6 years ago by brosner

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

(In [8867]) Fixed #8805 -- Make sure proper type coercion happens before dumping data into join for limit_choices_to when building the URL parameters for the ForeignKeyRawIdWidget popup.

comment:5 Changed 3 years ago by jacob

  • milestone 1.0 deleted

Milestone 1.0 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.