Home | Trees | Indices | Help |
|
---|
|
object --+ | _2many.result --+ | many2many.result
|
|||
|
select(self,
*clauses) Use like this: |
||
|
len(self,
*clauses) Return the number of child objects associated with a parent. |
||
|
where(self) Return the WHERE clause that selects the child objects for the given parent. |
||
|
all(self,
*clauses) This method will return all entries in the child relation (or a subset specified by clauses) and a list of those primary keys which are present in the link table. |
||
|
append(self,
*new_child_objects) Appends new child objects to the parent's many2many dbproperty. |
||
|
unlink(self,
child_object) Remove the entry from the link relation that links it to the parent dbobj. |
||
|
unlink_by_primary_key(self,
pkey) Remove an entry from the link relation that links the parent dbobj to a child identfyed by pkey |
||
Inherited from Inherited from |
|
|||
Inherited from |
|
>>> result = dbobj.children.select(sql.where(...))This will yield those child objects that fit the condition in the where statements. Note that your WHERE will be integrated into a more complex WHERE clause. The many2many relationship uses a LEFT JOIN to connect the link_relation and the child relation. You must do that by hand. Also, doing so might mess up your db, so you might want to use FOREIGN KEY constraints on the link relation.
|
|
|
>>> result, active_keys = dbobj.relation.all() >>> for a in result: ... if a.__primary_key__.values() in active_keys: ... do_something(a) ... else: ... do_somethin_else(a) |
|
|
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0alpha3 on Wed Feb 20 18:17:28 2008 | http://epydoc.sourceforge.net |