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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:35:57+00:00 2026-05-12T15:35:57+00:00

thechan = Score.objects.filter(content=44)[0:1] thechan[0].custom_score = 2 thechan[0].save() I do print statements, and it shows

  • 0
thechan = Score.objects.filter(content=44)[0:1]
thechan[0].custom_score = 2
thechan[0].save()

I do print statements, and it shows everything fine. However, it’s not SAVING!

I go into my database, and I run a simple SELECT statement..and it’s not changed!

select custom_score FROM music_score where content_id = 44;
  • 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-12T15:35:57+00:00Added an answer on May 12, 2026 at 3:35 pm

    What’s going on here is that Score.objects.filter() doesn’t return a regular list, but a QuerySet. QuerySets behave like lists in some ways, but every time you slice one you get a new QuerySet instance, and everytime you index into one, you get a new instance of your model class.

    That means your original code does something like:

    thechan = Score.objects.filter(content=44)[0:1]
    thechan[0].custom_score = 2
    
    thechan = Score.objects.filter(content=44)[0:1]
    thechan[0].save() # saves an unmodified object back to the DB, no effective change
    

    If for whatever reason you needed to do this on a QuerySet rather than just using get(), you could write:

    thechan = Score.objects.filter(content=44)[0]
    thechan.custom_score = 2
    thechan.save()
    

    instead. This distinction becomes a bit more important if you are, say, iterating over the elements of a QuerySet instead of dealing with a single record.

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

Sidebar

Related Questions

I feel like I tried everything to clone http://thechaw.com/source from git with no success.
//element of chain. struct studentRecord { int score; string* name; int operator !=(studentRecord x)
I have A game to which I recently added a global high score functionality
I'm not entire sure how to write this in VBA using a macro. I
What's the benefit of using InputStream over InputStreamReader , or vice versa. Here is
What I need to do is parse a huge string of text into sentences.
I need to put together a concurrent system with one shared Control.Concurrent.Chan between threads.
I am working on code that takes as input a ton of ascii text
I'm trying to write a simple chat bot for Adium, that will post lol
Does anyone know if it is possible to do lock-free programming in Haskell? I'm

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.