On Wednesday 08 July 2009 14:36:17 AkA wrote:
> Hi, I'm trying to modify my TG1 application with SQLObject into a TG2
> version with SQLAlchemy.
> First I checked the TG2 tutorials and got the simple object mapping
> examples working but now I want to implement a one-to-many
> relationship I get a
> < NameError: name 'Address' is not defined >
> when I add relationship to my model. I compared my file with the
> generated auth.py and there's no much difference.
> What's more confusing is that SQLAlchemy documentation talks about
> mapping with the sqlalchemy.orm.mapper.
> The file location.py contains my current two classes:
>
> class City(DeclarativeBase):
> __tablename__ = 'city'
>
> #{ Columns ## not relevant
> #{ Relations
> adresses = relation('Address', order_by=Address.id,
> backref='city')
Here you refer to Address, which you declare below.
I don't know much about declarative (using elixir), but this might need to
be "Addrees.id" (the quotes are important)
Diez
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---