That's not the point ;) discussed here... indeed the Book model (see
below) do get a pages_set including all pages of that book, the
problem discussed here is that the Book model can't declare the
first property because it references the Page model which is not yet
loaded by the interpreter.
Let's say it can't be elegantly solved! ;)
On Oct 15, 9:46 pm, Andy Freeman [EMAIL PROTECTED] wrote:
as yejun wrote up at the top, the following works, but doesn't verify
that assignments to Book().first are instances of Page.
class Book(db.Model):
title = db.StringProperty()
If you add a reference to one model from the other, the other model
automatically gets a back reference...
class Point(db.Model):
Store the map points
point = db.GeoPtProperty(required = True)
title = db.StringProperty(required = False)
owner =
Maybe:
class Book(db.Model):
title = db.StringProperty()
first = db.ReferenceProperty(Page)
class Page(db.Model):
text = db.TextProperty()
next = db.SelfReferenceProperty()
book =
Using multiple files for dbModel subclass definitions during
development runs into the GAE/python doesn't reload what hasn't
changed problem.
If db.Model A is defined in fileA, db.Model B is defined in fileB and
B has a db.ReferenceProperty to A, B's definition will generate errors
when you
The problem really has nothing to do with how import works. It's an
execution order problem.
Short version: yes, the problem is that Page doesn't exist when Book
is defined. However, it has nothing to do with imports.
Long version:
Import reads and executes statements from a file and makes
I am having the same problem when defining a join model between two
models... because they depend on each other, but in my case is a
problem related to how Python imports classes (I am using import
to pull in models definitions that are in different files). Does the
code that you posted all
You don't have to give class for ReferenceProperty.
first = db.ReferenceProperty()
On Oct 9, 6:53 pm, acuth [EMAIL PROTECTED] wrote:
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