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

  • Home
  • SEARCH
  • 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 8695611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:04:56+00:00 2026-06-13T01:04:56+00:00

Im sending a POST that creates a new simple Resource (not a ModelResource), and

  • 0

Im sending a POST that creates a new simple Resource (not a ModelResource), and that works.

My question is how do I get back for example the created resource’s bundle property to the ajax response?

That’s the resource example :

class MyResource(Resource):
    x = fields.CharField(attribute='x')
    y = fields.CharField(attribute='y')

    class Meta:
        resource_name = 'myresource'
        object_class = XYObject
        authorization   = Authorization()

    def obj_create(self, bundle, request=None, **kwargs):
        x = bundle.data["x"]
        x = bundle.data["y"]
        bundle.obj = XYObject(x, y)
        return bundle

And this is the POST request

$.ajax({
               type: "POST",
               url: '/api/v1/myresource/',
               contentType: 'application/json',
               data: data,
               dataType: 'json',
               processData: false,
               success: function(response)
               {
                //get my resource here
               },
               error: function(response){
                   $("#messages").show('error');
                 }
               });
  • 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-06-13T01:04:57+00:00Added an answer on June 13, 2026 at 1:04 am

    You can just add always_return_data = True to your Meta. You’ll then get a 202 with serialized data instead of the normal 201.

    from https://stackoverflow.com/a/10138745/931277

    Here are the docs: http://django-tastypie.readthedocs.org/en/latest/resources.html#always-return-data

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

Sidebar

Related Questions

I created a list that auto-grows as new content is added. It's a simple
I'm sending a large amount of text to my webpage by POST that's received
I have a problem sending POST request with VB6. The code below works properly
When sending data via POST or GET with jQuery you use for format {
I got some sample code from the net here: http://www.javadb.com/sending-a-post-request-with-parameters-from-a-java-class That works fine. It
I have a problem with sending POST http request. It stops on (HttpWebResponse)request.GetResponse() and
I'm trying to refresh a page without sending POST from the previous time. I've
I'm sending a POST to a URL, with content type as application/x-www-form-urlencoded and in
I had an issue where I was sending a POST to Grails 1.3.7 with
Im sending (with ASIFormDataRequest) a POST request, with 4 parameters. The server launches a

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.