On Sat, Dec 13, 2008 at 11:24:51AM -0500, inhahe wrote:
> Hi, can I get some help on something else

   Sure.

> i create a new record, using instantiation like normal, and then i
> want to create a record in another table with a foreignkey to the
> first record.  the thing is i have no idea how to refer to that first
> record to pass it as the foreign key argument.   i tried a couple of
> different ways and looked at the documentation a little bit, to no
> avail.
> 
> here's my code
> 
> user = Users(username=username, password=password1,
> staddress=staddress, address2=address2, zip=zip, phoneday=phoneday,
>                phoneeve=phoneeve, dob='%d-%d-%d' % (y,m,d),
> state=state, email=email, fullname=fullname, city=city)
> registercode = str(random.randint(0,1000000000)) ## cheap
> RegisterSessions(user=????, sessioncode=registercode)

   Use the very object you want to point to, or its id:

RegisterSessions(user=user, sessioncode=registercode)
   or
RegisterSessions(user=user.id, sessioncode=registercode)

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            p...@phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to