title: How to update queryset value in django?
body: <p>I have written a python script in my project. I want to update the value of a field.</p>
  
  <p>Here are my modes</p>
  
  <pre><code>
  class News_Channel(models.Model):
      name = models.TextField(blank=False)
      info = models.TextField(blank=False)
      image = models.FileField()
      website = models.TextField()
      total_star = models.PositiveIntegerField(default=0)
      total_user = models.IntegerField()
  
      class Meta:
          ordering = ["-id"]
  
      def __str__(self):
          return self.name
  
  class Count(models.Model):
      userId = models.ForeignKey(User, on_delete=models.CASCADE)
      channelId = models.ForeignKey(News_Channel, on_delete=models.CASCADE)
      rate = models.PositiveIntegerField(default=0)
  
      def __str__(self):
          return self.channelId.name
  
      class Meta:
          ordering = ["-id"]
  </code></pre>
  
  <p>This is my python script:</p>
  
  <pre><code>from feed.models import Count, News_Channel
  
  
  def run():
      for i in range(1, 11):
          news_channel = Count.objects.filter(channelId=i)
          total_rate = 0
          for rate in news_channel:
              total_rate += rate.rate
          print(total_rate)
          object = News_Channel.objects.filter(id=i)
          print(total_rate)
          print("before",object[0].total_star,total_rate)
          object[0].total_star = total_rate
          print("after", object[0].total_star)
          object.update()
  
  </code></pre>
  
  <p>After counting the total_rate from the Count table I want to update the total star value in News_Channel table. I am failing to do so and get the data before the update and after the update as zero. Although total_rate has value.</p>