On Wed, Jul 2, 2008 at 12:21 PM, jrpfinch <[EMAIL PROTECTED]> wrote:
>
> Hi I'm new at TurboGears and am getting slightly confused/lost by the
> SQLObject docs.
>
> I would be grateful if somebody could explain what the easiest way to
> get the ems_name of a record in Ne_live is.
>
> b=Ne_live.get(4)
> b.Ems_live.ems_name ?????????
> Traceback (most recent call last):
> File "<console>", line 1, in ?
> AttributeError: 'Ne_live' object has no attribute 'Ems_live'
> c.ne_ems_id.ems_name ?????
> Traceback (most recent call last):
> File "<console>", line 1, in ?
> AttributeError: 'int' object has no attribute 'ems_name'
>
>
> class Ems_live(SQLObject):
> class sqlmeta:
> idName = "ems_id"
> ems_name = StringCol()
> ems_sm_time = DateTimeCol()
> ems_sm_code = IntCol()
>
> class Ne_live(SQLObject):
> class sqlmeta:
> idName = "ne_id"
> ne_ems_id = ForeignKey("Ems_live")
> ne_name = StringCol()
>
>
> Many thanks
>
> Jon
>
First, if you're just getting started with TG, you might really want to
consider using SQLAlchemy rather than SQLObject. I totally understand if
you want to take the learning curve in small doses, though.
Second, I think (based on a hazy memory of SQLObject), that you want
something like:
b=Ne_live.get(4)
b.ne_ems_id.ems_name
You might want to check out this tutorial for more info:
http://exogen.case.edu/turbogears.html
It's a little outdated, but it should give you an idea.
Good luck!
Kevin Horn
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---