Package pyperry :: Module association :: Class BelongsTo
[frames] | no frames]

Class BelongsTo

source code

 object --+    
          |    
Association --+
              |
             BelongsTo

Builds the association scope for a belongs association. See the Association class for more details on how associations work.

Instance Methods
 
type(self) source code
 
collection(self) source code
 
get_foreign_key(self) source code
 
set_foreign_key(self, value) source code
 
polymorphic(self) source code
 
polymorphic_type(self) source code
 
scope(self, obj_or_list)
Returns a scope on the source class containing this association
source code

Inherited from Association: __call__, __init__, eager_loadable, finder_options, primary_key, source_klass

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties
  foreign_key

Inherited from object: __class__

Method Details

type(self)

source code 
Overrides: Association.type

collection(self)

source code 
Overrides: Association.collection

get_foreign_key(self)

source code 
Overrides: Association.get_foreign_key

set_foreign_key(self, value)

source code 
Overrides: Association.set_foreign_key

polymorphic(self)

source code 
Overrides: Association.polymorphic

scope(self, obj_or_list)

source code 

Returns a scope on the source class containing this association

Builds conditions on top of the base_scope generated from any finder options set with the association:

   belongs_to('foo', foreign_key='foo_id')

In addition to any finder options included with the association options the following scope will be added:

   where('id = %s' % target['foo_id'])
Overrides: Association.scope

Property Details

foreign_key

Get Method:
get_foreign_key(self)
Set Method:
set_foreign_key(self, value)