I am creating an application using Python (2.7) and GAE. I am trying to create a one-to-many relationship. There is one client with numerous properties which also has many potential contacts. Contacts also has various properties. The example of using the ndb.StructuredProperty seems pretty straight forward, but when I import my data model with a structured property line, I keep getting the following error in my log:
NameError: Name 'Contact' is not defined.
Any help would be greatly appreciated.
main.py
from dataObjects import *
dataObjects.py
class Client(ndb.Model):
createDate = ndb.DateProperty()
name = ndb.StringProperty()
address1 = ndb.StringProperty()
address2 = ndb.StringProperty()
state = ndb.StringProperty()
zipCode = ndb.StringProperty()
phone = ndb.StringProperty()
fax = ndb.StringProperty()
website = ndb.StringProperty()
city = ndb.StringProperty()
industry = ndb.StringProperty()
status = ndb.StringProperty()
notes = ndb.StringProperty()
financing = ndb.StringProperty()
contacts = ndb.StructuredProperty(Contact, repeated=True)
class Contact(ndb.Model):
firstName = ndb.StringProperty()
lastName = ndb.StringProperty()
role = ndb.StringProperty()
status = ndb.StringProperty()
phone = ndb.StringProperty()
fax = ndb.StringProperty()
email = ndb.StringProperty()
createDate = ndb.DateProperty()
isClient = ndb.StringProperty()
address = ndb.StringProperty()