Is it possible to have two models reference each other? I can't get
this to work and haven't been able to find this limitation in the
documentation. As a simple example, consider:

class Book(db.Model):
        title = db.StringProperty()
        first = db.ReferenceProperty(Page)

class Page(db.Model):
        text = db.TextProperty()
        next = db.SelfReferenceProperty()
        book = db.ReferenceProperty(Book)

which generates "NameError: name 'Page' is not defined" when
processing the Book class definition. Is this really a limitation of
the underlying data store or is it more related to how models are
defined in Python?

I'm guessing the solution is to record the 'first page in book'
information as a separate class, for example:

class FirstPage(db.Model):
        book = db.ReferenceProperty(Book)
        first = db.ReferenceProperty(Page)

any pointers would be gratefully received, Adrian



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to