title: getting list index out of range when function is being called Django
body: <p>I am trying get total here,
  whenever i add the new record i got the error
  I don't know why i got list index out of range
  I m calling the function in <code>admin.py</code></p>
  <p>This is my <code>models.py</code> file</p>
  <pre><code>class Buyer(models.Model):
      buyer_name = models.CharField(max_length=256,unique=True)
    
      def __str__(self):
          return self.buyer_name
      
      def buyerdebittotal(self):
          queryset = Buyer.objects.filter(policybuyer__buyer_id = self.id).annotate(total=Sum('policybuyer__buyerdebit',))
          return queryset[0].total     
  
  class Policy(models.Model):
      buyer = models.ForeignKey(Buyer,on_delete=models.DO_NOTHING,related_name='policybuyer')
      buyerdebit = models.FloatField(default=0)
  
      def get_absolute_url(self): 
          return reverse(&quot;insurance:updatepolicy&quot;, kwargs={&quot;id&quot;: self.id})
  </code></pre>