Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7552249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:42:48+00:00 2026-05-30T10:42:48+00:00

Im using backbone-tastypie to create a nested resource as so. class ServiceResource(ModelResource): manager =

  • 0

Im using backbone-tastypie to create a nested resource as so.

class ServiceResource(ModelResource):
    manager = fields.ToOneField(UserResource, 'manager',full=True)
    area = fields.ToOneField(AreaResource, 'area',full=True)
    specification = fields.ToManyField('services.api.ServiceSpecResource','servicespec_set',full=True)
    class Meta:
        queryset = Service.objects.all()
        resource_name = 'service'

class ServiceSpecResource(ModelResource):
    service = fields.ToOneField(ServiceResource,'service')
    servicespecrange = fields.ToManyField('services.api.ServiceSpecRangeResource','servicespecrange_set',full=True)
    servicespecconstant = fields.ToManyField('services.api.ServiceSpecConstantResource','servicespecconstant_set',full=True)
    servicespecgeneric = fields.ToManyField('services.api.ServiceSpecGenericResource','servicespecgeneric_set',full=True)
    class Meta:
        queryset = ServiceSpec.objects.all()
        resource_name = 'servicespec'
        list_allowed_methods = ['get', 'post']
        detail_allowed_methods = ['get', 'put', 'delete']
        authorization = DjangoAuthorization()

class ServiceSpecRangeResource(ModelResource):  
    servicespec = fields.ToOneField(ServiceSpecResource,'service_spec')
    class Meta:
        queryset = ServiceSpecRange.objects.all()
        resource_name = 'servicespecrange'

class ServiceSpecConstantResource(ModelResource):   
    servicespec = fields.ToOneField(ServiceSpecResource,'service_spec')
    class Meta:
        queryset = ServiceSpecConstant.objects.all()
        resource_name = 'servicespecconstant'

class ServiceSpecGenericResource(ModelResource):
    servicespec = fields.ToOneField(ServiceSpecResource,'service_spec')
    class Meta:
        queryset = ServiceSpecGeneric.objects.all()
        resource_name = 'servicespecgeneric'

For getting the ServiceResource it works great. I get back a Service object back which contains all the ServiceSpecification’s which in turn has all the ServiceSpecRange’s/constants etc.

Putting the whole nested resource back to the server also works fine for existing data.

However, whenever I try to post a whole nested resource in one go (new service with new servicespec attached) I get:

int() argument must be a string or a number, not ‘list’

I have had this error before, and found it related to not including a resource_uri to a related resource. But in this case, i’m posting – so it shouldn’t be complaining about missing resource_uri’s in a nested resource. The reason they aren’t included is because the parent resource hasn’t been saved yet. Is tastypie not advanced enough to see this?

Here is the traceback:

{ “error_message”:”int() argument must be a string or a number, not
‘list'”, “traceback”:”Traceback (most recent call last):

File \”build/bdist.linux-x86_64/egg/tastypie/resources.py\”, line 192,
in wrapper response = callback(request, *args, **kwargs)

F> ile \”build/bdist.linux-x86_64/egg/tastypie/resources.py\”, line 397,
in dispatch_list return self.dispatch(‘list’, request, **kwargs)

File \”build/bdist.linux-x86_64/egg/tastypie/resources.py\”, line 427,
in dispatch response = method(request, **kwargs)

File \”build/bdist.linux-x86_64/egg/tastypie/resources.py\”, line
1165, in post_list updated_bundle = self.obj_create(bundle,
request=request, **self.remove_api_resource_names(kwargs))

File \”build/bdist.linux-x86_64/egg/tastypie/resources.py\”, line
1783, in obj_create m2m_bundle = self.hydrate_m2m(bundle)

File \”build/bdist.linux-x86_64/egg/tastypie/resources.py\”, line 743,
in hydrate_m2m bundle.data[field_name] =
field_object.hydrate_m2m(bundle)

File \”build/bdist.linux-x86_64/egg/tastypie/fields.py\”, line 742, in
hydrate_m2m m2m_hydrated.append(self.build_related_resource(value,
**kwargs))

File \”build/bdist.linux-x86_64/egg/tastypie/fields.py\”, line 593, in
build_related_resource return
self.resource_from_data(self.fk_resource, value, **kwargs)

File \”build/bdist.linux-x86_64/egg/tastypie/fields.py\”, line 548, in
resource_from_data return fk_resource.obj_update(fk_bundle, **data)

File \”build/bdist.linux-x86_64/egg/tastypie/resources.py\”, line
1814, in obj_update bundle.obj = self.obj_get(request,
**lookup_kwargs)

File \”build/bdist.linux-x86_64/egg/tastypie/resources.py\”, line
1752, in obj_get base_object_list =
self.get_object_list(request).filter(**kwargs)

File
\”/usr/local/lib/python2.7/site-packages/django/db/models/query.py\”,
line 550, in filter return self._filter_or_exclude(False, *args,
**kwargs)

File
\”/usr/local/lib/python2.7/site-packages/django/db/models/query.py\”,
line 568, in _filter_or_exclude clone.query.add_q(Q(*args, **kwargs))

File
\”/usr/local/lib/python2.7/site-packages/django/db/models/sql/query.py\”,
line 1194, in add_q can_reuse=used_aliases, force_having=force_having)

File
\”/usr/local/lib/python2.7/site-packages/django/db/models/sql/query.py\”,
line 1129, in add_filter connector)

File
\”/usr/local/lib/python2.7/site-packages/django/db/models/sql/where.py\”,
line 67, in add value = obj.prepare(lookup_type, value)

File
\”/usr/local/lib/python2.7/site-packages/django/db/models/sql/where.py\”,
line 316, in prepare return self.field.get_prep_lookup(lookup_type,
value)

File
\”/usr/local/lib/python2.7/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
\”/usr/local/lib/python2.7/site-packages/django/db/models/fields/related.py\”,
line 209, in _pk_trace v = getattr(field, prep_func)(lookup_type, v,
**kwargs)

File
\”/usr/local/lib/python2.7/site-packages/django/db/models/fields/init.py\”,
line 292, in get_prep_lookup return self.get_prep_value(value)

File
\”/usr/local/lib/python2.7/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’ ” }

EDIT:

I believe this issue is related:

https://github.com/toastdriven/django-tastypie/issues/307

Along with this test case:

https://github.com/joshbohde/django-tastypie/commit/eef8d27fb65d5777a98a3df034af26ceb317deb3

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T10:42:49+00:00Added an answer on May 30, 2026 at 10:42 am

    This has been fixed in another branch. See the pull request.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building an app using Brunch and Backbone.js that is to include nested menus.
Using Backbone.JS, I am able to successfully create new models and save them to
I am using backbone and trying to create a new object and I am
I've just started using Backbone.js. I want to create a Collection and add some
Using C#, I need a class called User that has a username, password, active
Using preview 4 of ASP.NET MVC Code like: <%= Html.CheckBox( myCheckBox, Click Here, True,
I'm using backbone with the backbone-rails gem which does its own templating and project
We are using Backbone.js to build client-side UI that manipulates models shared by multiple
I am using backbone to build my web app. Currently I am facing an
I'm using backbone's underscore templating engine with the mustache formatting patterns. I have already

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.