title: Django model method with self instance
body: <p>I am trying to move some functional logic into a model's method (instead of in the views), where I think it belongs:</p>
  
  <pre><code>class Spans(models.Model):
      snow = models.IntegerField()
      wind = models.IntegerField()
      exposure = models.CharField(max_length=1)
      module_length = models.IntegerField()
      max_roof_angle = models.IntegerField()
      building_height = models.IntegerField()
      importance_factor = models.IntegerField()
      seismic = models.DecimalField(max_digits=4, decimal_places=2)
      zone = models.IntegerField()
      profile = models.CharField(max_length=55)
      tilt_angle = models.IntegerField()
      span = models.DecimalField(max_digits=18, decimal_places=15)
  
      def get_spans(self, snow_load, wind_speed, module_length):
          """
          Function to get spans.
          """
          spans = self.objects.filter(
              snow=snow_load,
              wind=wind_speed,
              exposure='B',
              module_length__gte=module_length,
              max_roof_angle=45,
              building_height=30,
              importance_factor=1,
              seismic=1.2,
              zone=1,
              profile='worst'
          ).order_by('snow', 'module_length', 'span')
          return spans
  </code></pre>
  
  <p>However, I am a little unsure how to call it. In the shell I have tried:</p>
  
  <pre><code>&gt;&gt;&gt; possible_spans = Spans.get_spans(0, 85, 54)
  </code></pre>
  
  <p>or</p>
  
  <pre><code>&gt;&gt;&gt; possible_spans = Spans.get_spans(Spans, 0, 85, 54)
  </code></pre>
  
  <p>but I get an error:</p>
  
  <pre><code>TypeError: unbound method get_spans() must be called with Spans instance as first argument (got int instance instead) 
  </code></pre>
  
  <p>or</p>
  
  <pre><code>TypeError: unbound method get_spans() must be called with Spans instance as first argument (got ModelBase instance instead)  
  </code></pre>
  
  <p>I know I am missing something fundamental in python logic here, but I'm not sure what it is.</p>
  
  <p>Any help would be much appreciated.</p>