9

If I have two types of models that each reference each other, whichever one I try to define first says it does not recognize the referenced other type (because it is defined further down in the file). For example:

class Author(db.Model):
    most_recent_book = db.ReferenceProperty(Book)

class Book(db.Model):
    author = db.ReferenceProperty(Author)

This will claim that the referenced "Book" model is not recognized. If I flip the order, I run into the same issue (except it will say that "Author" is not recognized). How do I get around this?

ryan
  • 2,311
  • 3
  • 22
  • 28

1 Answers1

6

You can use ReferenceProperty without declaring a type as described in this article from AppEngine Tips

Adam Crossland
  • 14,198
  • 3
  • 44
  • 54