title: Does Django ORM have an equivalent to SQLAlchemy's Hybrid Attribute?
body: <p>In <a href="http://docs.sqlalchemy.org/en/rel_0_7/index.html" rel="nofollow noreferrer">SQLAlchemy</a>, a <a href="http://docs.sqlalchemy.org/en/rel_0_7/orm/extensions/hybrid.html" rel="nofollow noreferrer">hybrid attribute</a> is either a <a href="https://stackoverflow.com/questions/6618002/python-property-versus-getters-and-setters">property</a> or method applied to an ORM-mapped class,</p>
  
  <pre><code>class Interval(Base):
      __tablename__ = 'interval'
  
      id = Column(Integer, primary_key=True)
      start = Column(Integer, nullable=False)
      end = Column(Integer, nullable=False)
  
      def __init__(self, start, end):
          self.start = start
          self.end = end
  
      @hybrid_property
      def length(self):
          return self.end - self.start
  
      @hybrid_method
      def contains(self,point):
          return (self.start &lt;= point) &amp; (point &lt; self.end)
  
      @hybrid_method
      def intersects(self, other):
          return self.contains(other.start) | self.contains(other.end)
  </code></pre>
  
  <p>This allows for distinct behaviors at the class and instance levels, thus making it simpler to evaluate SQL statements using the same code,</p>
  
  <pre><code>&gt;&gt;&gt; i1 = Interval(5, 10)
  &gt;&gt;&gt; i1.length
  5
  
  &gt;&gt;&gt; print Session().query(Interval).filter(Interval.length &gt; 10)
  SELECT interval.id AS interval_id, interval.start AS interval_start,
  interval."end" AS interval_end
  FROM interval
  WHERE interval."end" - interval.start &gt; :param_1
  </code></pre>
  
  <p>Now in <a href="https://docs.djangoproject.com/en/1.4/topics/db/models/" rel="nofollow noreferrer">Django</a>, if I have a property on a model,</p>
  
  <pre><code>class Person(models.Model):
      first_name = models.CharField(max_length=50)
      last_name = models.CharField(max_length=50)
  
      def _get_full_name(self):
          "Returns the person's full name."
          return '%s %s' % (self.first_name, self.last_name)
      full_name = property(_get_full_name)
  </code></pre>
  
  <p>It is my <a href="https://stackoverflow.com/questions/4754283/django-query-based-on-dynamic-property">understanding</a> that I can <em>not</em> do the following,</p>
  
  <pre><code>Person.objects.filter(full_name="John Cadengo")
  </code></pre>
  
  <p>Is there an equivalent of SQLAlchemy's hybrid attribute in Django? If not, is there perhaps a common workaround?</p>