Skip to content

Instantly share code, notes, and snippets.

@hgross
Created January 12, 2012 16:05
Show Gist options
  • Save hgross/1601325 to your computer and use it in GitHub Desktop.
Save hgross/1601325 to your computer and use it in GitHub Desktop.
Traceback of PUT on a toManyField
{"error_message": "int() argument must be a string or a number, not 'list'", "traceback": "Traceback (most recent call last):
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/tastypie/resources.py", line 178, in wrapper
response = callback(request, *args, **kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/tastypie/resources.py", line 379, in dispatch_list
return self.dispatch('list', request, **kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/tastypie/resources.py", line 409, in dispatch
response = method(request, **kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/tastypie/resources.py", line 1040, in put_list
self.obj_create(bundle, request=request)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/tastypie/resources.py", line 1534, in obj_create
m2m_bundle = self.hydrate_m2m(bundle)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/tastypie/resources.py", line 711, in hydrate_m2m
bundle.data[field_name] = field_object.hydrate_m2m(bundle)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/tastypie/fields.py", line 649, in hydrate_m2m
m2m_hydrated.append(self.build_related_resource(value))
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/tastypie/fields.py", line 515, in build_related_resource
return self.fk_resource.obj_update(self.fk_bundle, **value)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/tastypie/resources.py", line 1560, in obj_update
bundle.obj = self.obj_get(request, **lookup_kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/tastypie/resources.py", line 1508, in obj_get
base_object_list = self.get_object_list(request).filter(**kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/db/models/query.py", line 550, in filter
return self._filter_or_exclude(False, *args, **kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/db/models/query.py", line 568, in _filter_or_exclude
clone.query.add_q(Q(*args, **kwargs))
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/db/models/sql/query.py", line 1172, in add_q
can_reuse=used_aliases, force_having=force_having)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/db/models/sql/query.py", line 1107, in add_filter
connector)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/db/models/sql/where.py", line 67, in add
value = obj.prepare(lookup_type, value)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/db/models/sql/where.py", line 316, in prepare
return self.field.get_prep_lookup(lookup_type, value)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/db/models/fields/related.py", line 136, in get_prep_lookup
return self._pk_trace(value, 'get_prep_lookup', lookup_type)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/db/models/fields/related.py", line 209, in _pk_trace
v = getattr(field, prep_func)(lookup_type, v, **kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/db/models/fields/__init__.py", line 292, in get_prep_lookup
return self.get_prep_value(value)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/db/models/fields/__init__.py", line 479, in get_prep_value
return int(value)
TypeError: int() argument must be a string or a number, not 'list'
"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment