title: How to call a method from a Django Class Model to a Django field?
body: <p>I have created the following Django Model and I am trying to initialize one field - <code>points</code> - with the total number of instances of that same model, that is:</p>
  
  <pre><code>class Task(models.Model):
      DEFAULT_VALUE     = 5
      description       = models.CharField(max_length=60)
      points            = self.total() * DEFAULT_VALUE
      STATUS            = (('A', 'Active'), ('C', 'Cancelled'), ('D', 'Done'))
      status            = models.CharField(max_length=1, choices=STATUS, default='A')
  
      def total(self):
          count_active = len(Task.objects.filter(status='A'))
          return count_active
  </code></pre>
  
  <p>In the <code>python manage.py shell</code> I can create two instances of <code>Task</code> and I can determine the total number of the instances that have been created with <code>len(Task.objects.filter(status='A')))</code>, however, when I try to implement this same code into a function then I encounter that <code>self</code> is an unresolved reference. What did I miss?</p>