Show
Ignore:
Timestamp:
02/01/07 23:30:27 (7 years ago)
Author:
cleverdevil
Message:

A bunch of docstring updates, representing a good chunk of documentation.
The docstring on relationships is only partially done, as I ran out of
gas after describing the 'belongs_to' relationship type.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • elixir/trunk/elixir/relationships.py

    r17 r18  
     1''' 
     2This module provides support for defining relationships between your Elixir  
     3entities.  The supported relationship types are as follows: 
     4 
     5    `belongs_to` 
     6    ------------ 
     7    Describes the child's side of a parent-child relationship.  For example,  
     8    a `Pet` object may belong to its owner, who is a `Person.`  This could be 
     9    expressed like so: 
     10                 
     11        class Pet(Entity): 
     12            belongs_to('owner', of_kind='Person', inverse='pets') 
     13     
     14    You must specify the 'kind' of object that you are relating to using the 
     15    of_kind keyword argument.  Additionally, if you plan on defining the other 
     16    side of the relationship, you should specify the name of the relationship 
     17    on the other side using the 'inverse' keyword argument. 
     18 
     19 
     20    `has_one` 
     21    --------- 
     22    TODO. 
     23     
     24 
     25    `has_many` 
     26    ---------- 
     27    TODO. 
     28 
     29 
     30    `has_and_belongs_to_many` 
     31    ------------------------- 
     32    TODO. 
     33''' 
     34 
    135from sqlalchemy         import relation, ForeignKeyConstraint, Column, \ 
    236                               Table, and_ 
     
    1852class Relationship(object): 
    1953    ''' 
    20     Base class for relationships 
     54    Base class for relationships. 
    2155    ''' 
    2256     
     
    151185 
    152186class BelongsTo(Relationship): 
     187    ''' 
     188     
     189    ''' 
     190     
    153191     
    154192    def create_keys(self):