Documentation for stdnet 0.8.2. For development docs, go here.

Double Underscore NotationΒΆ

Stdnet makes extensive use of the __ double-underscore notation in several parts of the API.

  • A Query with range and text lookups:

    >>> from stdnet import odm
    >>> models = odm.Router()
    >>> models.register(MyModel)
    >>> qs = odm.mymodel.filter(size__gt=40, description__contains='technology')
  • An Query on a Field of a related model. For example, in the Position model one can filter, exclude or sort, with respect the instrument ccy Field in this way:

    qs = models.position.filter(instrument__ccy='EUR')
    qs = models.position.exclude(instrument__ccy='EUR')
    qs = models.position.query().sort_by('instrument__ccy')
  • In conjunction with load_only query method when you need to load only a subset of a related model fields:

    qs = models.position.query().load_only('size', 'instrument__ccy')
  • In the StdModel.get_attr_value() method, for example:

    # same as


    # same as

Previous topic


Next topic

Export & Load data

This Page