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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:14:33+00:00 2026-06-11T10:14:33+00:00

Given the below JSON result from tastypie, I would like to create a new

  • 0

Given the below JSON result from tastypie, I would like to create a new value at check.payments_total which is equal to the total amount of the payments (in this case, 44.00). Any clue on how to do this? I’m completely stumped. payments is a joined foreign key to the check table.

{
"objects": [
    {
        "check": {
            "id": "58a81b36-1ea6-403b-9902-a50cbd13cf2e",
            "number": 2,
            "payments": [
                {
                    "amount": "5.00",
                },
                {
                    "amount": "39.00",
                }
            ]
        }
    }
]
}
  • 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-11T10:14:35+00:00Added an answer on June 11, 2026 at 10:14 am

    If for the response, then you could override the following method in your resource (the snippet is from tastypie.resources.Resource):

    def alter_list_data_to_serialize(self, request, data):
        """
        A hook to alter list data just before it gets serialized & sent to the user.
    
        Useful for restructuring/renaming aspects of the what's going to be
        sent.
    
        Should accommodate for a list of objects, generally also including
        meta data.
        """
        return data
    

    just include something like (not tested, consider to be pseudo-code):

     total_amount = 0.0
     for object in data[ 'objects' ]:
         total_amount += object[ 'amount' ]
    
     return { 'objects' : data[ 'objects' ], 'total_amount' : total_amount }
    

    and you should be done.

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

Sidebar

Related Questions

i need to parse the JSON data given below. {result:[{bookId:142645,bookpb:MF, bookTs:1328999630000,clipStatus:D,bookDetail:{arrival:1,purchase:1,sold:1}, hierarchies:{categories:[4],events:[]},shopId:769752}, upto sold
I'm trying to read from a JSON response something like below { URL: {
Given the simple JSON below, how can I use jQuery to append each result
I ve data in the JSON format given below,need to populate the slick grid
Given below is program for encrypting a string. I had taken this code from
for the Given below code after int Input Value of 46348 i am getting
Hello friends i am running code given below which contains the setLogTimeEntery function and
I am having trouble to parse a JSON string. The JSON is given below:
I am getting JSon data from a web service, the sample data is given
hi I am trying to fetch data from link as given below http://abovestress.com/app_stress/fetch_all_detail.php?task=fetchtimefromdateanduserid&track_date=2011-08-09&tracker_user_id=374 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.