Opened 16 years ago

Closed 16 years ago

Last modified 13 years ago

#8805 closed (fixed)

TypeError: sequence expected, int found

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

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

Change History (5)

comment:1 by anonymous, 16 years ago

but

limit_choices_to={'status__gte' : 3}

is works.

comment:2 by Mikhail Mitrofanov, 16 years ago

admin.py

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

comment:3 by Brian Rosner, 16 years ago

milestone: 1.0

comment:4 by Brian Rosner, 16 years ago

Resolution: fixed
Status: newclosed

(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 by Jacob, 13 years ago

milestone: 1.0

Milestone 1.0 deleted

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