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 7561279
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:07:25+00:00 2026-05-30T13:07:25+00:00

Here are my resources: class CourseResource(ModelResource): subjects = fields.ToManyField(‘core.api.SubjectResource’, ‘subjects’, full=True) class Meta: queryset

  • 0

Here are my resources:

class CourseResource(ModelResource):  
    subjects = fields.ToManyField('core.api.SubjectResource', 'subjects', full=True)  
    class Meta:
        queryset = Course.objects.all()  
        resource_name = 'course'  
        authorization = Authorization()   
        validation = FormValidation(form_class=CourseForm) 

class SubjectResource(ModelResource):  
    class Meta:  
        queryset = Subject.objects.all()  
        resource_name = 'subject'  
        authorization = Authorization()  

I am trying to post using curl on a django-tastypie system.

curl --dump-header - -H "Content-Type: application/json" -X POST --data '{"title":"title 123","description":"sdfsadfsdf","created_by":"1","created_on":"2012-02-23 03:24:56","initial-created_on":"2012-02-23 03:24:56.419838","subjects":["/api/v1/subject/1/"]}' http://127.0.0.1:8000/api/v1/course/

This is what i get:

HTTP/1.0 400 BAD REQUEST
Date: Thu, 23 Feb 2012 12:28:15 GMT
Server: WSGIServer/0.1 Python/2.7.2+
Content-Type: application/json; charset=utf-8

{"subjects": ["\"/api/v1/subject/1/\" is not a valid value for a primary key."]}%

I have tried sending just the ids instead of the resource_uri too, but that also doesn’t work. I am sure my post data is wrong in some way. How do I fix this?

  • 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-30T13:07:26+00:00Added an answer on May 30, 2026 at 1:07 pm

    I fixed the error myself. The culprit was that i was using “through” in my models.py for the ManyToMany field connector. Removing through made it easy to take care of m2m saves. Else, my thing using ‘through’ should also work but I will have to make a resource of the connector and send the appropriate endpoints.

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

Sidebar

Related Questions

So I have this class here: package phil.droid.game; import android.content.Intent; import android.content.res.Resources; import android.os.Bundle;
Here is some class I got : <Style x:Key=BoutonMenu TargetType={x:Type Button}> <Setter Property=SnapsToDevicePixels Value=True/>
The intent here is to deal with obfuscated passwords for resources. We have an
Oracle 10g has Profiles that allow various resources to be limited. Here are some
Here is a simplification of my database: Table: Property Fields: ID, Address Table: Quote
I found some good resources for rotating a bitmap in android here and elsewher
After some help here, I've got WPF using the windows.forms notifyIcon class (It's not
I'm using a custom listview I found here: http://developer.android.com/resources/samples/ApiDemos/res/layout/linear_layout_9.html Seems to be valid in
Here's my binding source object: Public Class MyListObject Private _mylist As New ObservableCollection(Of String)
I've got a generic class that manages resources of all kinds of types, but

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.