I have an address class that i would like to use in several locations for 
instance vendors need addresses and customers need addresses.

I have my model split between 2 files globals and ar. A customer can have a 
default bill to address, default ship to address, and multiple address to 
choose from for ship to's beyond the default. I have the bill_to and 
ship_to default working fine but for the life of me can't figure out how to 
create the locations reference. I know how to do it if i put it on the 
address class but then i have python import issues obviously. I could put 
them in the same file but then i lose the versalitity of having the same 
kind of address setup for vendors (defaults and multiples locations also). 
How can I define "locations" that would be a list of addresses on the 
customer class.

Hope this makes sense. TIA

AR model ..
from erp.model.globals import Address

class Customer(DeclarativeBase):
    __tablename__ = 'customers'
    customer_id = Column(Integer, primary_key=True)
    customer_name = Column(Unicode(100))
    discount = Column(Float)
    #bill_to_id = Column(Integer, ForeignKey('addresses.address_id'))
    #bill_to = 
relation(Address,primaryjoin=bill_to_id==Address.address_id,uselist=False)
    ship_to_id = Column(Integer, ForeignKey('addresses.address_id'))
    ship_to = 
relation(Address,primaryjoin=ship_to_id==Address.address_id,uselist=False)
    
globals ...
rom erp.model import DeclarativeBase, metadata, DBSession

class Address(DeclarativeBase):
    __tablename__ = 'addresses'
    address_id = Column(Integer,primary_key=True)
    name = Column(Unicode(100))
    address_one = Column(Unicode(100))
    address_two = Column(Unicode(100))
    address_three = Column(Unicode(100))
    city = Column(Unicode(100))
    state = Column(Unicode(100))
    zip_code = Column(Unicode(100))
    phone = Column(Unicode(100))
    fax = Column(Unicode(100))
    contact = Column(Unicode(100))

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sqlalchemy/-/0osPdVWRxgwJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to