title: How to extract numerical value from Django queryset?
body: <p>I feel like this is a very simple/stupid question, but for the life of me I can't figure it out.  I'm trying to pull an integer out of a queryset so I can use it with a mathematical operator.  All I can get is the queryset but not the actual number...</p>
  
  <pre><code>#models.py
  class Contract(models.Model):
      contract_number = models.IntegerField(help_text="This is an auto-calculated value for the sequential number of the contract associated with the account (chronological).", null=True, blank=True)
      account = models.ForeignKey(Account, on_delete=models.CASCADE)
  </code></pre>
  
  <hr>
  
  <pre><code>&gt;&gt;&gt; Contract.objects.filter(account="xyz").values_list('contract_number', flat=True)
  
     &lt;QuerySet [1]&gt;
  
  &gt;&gt;&gt;Max(Contract.objects.filter(account="xyz").values_list('contract_number', flat=True)) + 1
  
  &lt;CombinedExpression: Max(&lt;QuerySet [1]&gt;) + Value(1)&gt;
  </code></pre>
  
  <p>How do I get the actual number out of the queryset so I can use it?</p>
  
  <p>EDIT:  I added more clarity on what I was really trying to do with the Max() function.  There can be multiple objects of the same account name with different account numbers.  I want the maximum number from that list and then I want to add one to it.</p>