entity.py
changeset 9340 b1e933b0e850
parent 9293 723e2c586ea3
parent 9310 80c58c35145f
child 9359 31a1813d53f3
equal deleted inserted replaced
9322:2dae5bf5ea68 9340:b1e933b0e850
  1266 
  1266 
  1267         Example (in a shell session):
  1267         Example (in a shell session):
  1268 
  1268 
  1269         >>> c = rql('Any X WHERE X is Company').get_entity(0, 0)
  1269         >>> c = rql('Any X WHERE X is Company').get_entity(0, 0)
  1270         >>> p = rql('Any X WHERE X is Person').get_entity(0, 0)
  1270         >>> p = rql('Any X WHERE X is Person').get_entity(0, 0)
  1271         >>> c.set(name=u'Logilab')
  1271         >>> c.cw_set(name=u'Logilab')
  1272         >>> p.set(firstname=u'John', lastname=u'Doe', works_for=c)
  1272         >>> p.cw_set(firstname=u'John', lastname=u'Doe', works_for=c)
  1273 
  1273 
  1274         You can also set relations where the entity has 'object' role by
  1274         You can also set relations where the entity has 'object' role by
  1275         prefixing the relation name by 'reverse_'.  Also, relation values may be
  1275         prefixing the relation name by 'reverse_'.  Also, relation values may be
  1276         an entity or eid, a list of entities or eids, or None (meaning that all
  1276         an entity or eid, a list of entities or eids, or None (meaning that all
  1277         relations of the given type from or to this object should be deleted).
  1277         relations of the given type from or to this object should be deleted).