Have you read the "Many to Many" section of this article:

http://code.google.com/appengine/articles/modeling.html

<http://code.google.com/appengine/articles/modeling.html>

On Wed, Dec 22, 2010 at 11:06 PM, Kevin J <[email protected]> wrote:

> I have this code:
>
> -----
>
> class Group(db.Model):
>  leader = db.UserProperty()
>  description = db.StringProperty(multiline=False)
>  name = db.StringProperty(multiline=False)
>
> class Person(db.Model):
>  email = db.UserProperty()
>  groups = db.ListProperty(db.ReferenceProperty(Group))
>
> class Message(db.Model):
>  content = db.StringProperty(multiline=True)
>  group = db.ReferenceProperty(Group)
>  writer = db.ReferenceProperty(Person)
>  date = db.DateTimeProperty(auto_now=True)
>
> ----
>
> and this line is giving me an error:
>
>  groups = db.ListProperty(db.ReferenceProperty(Group))
>
> Here is my call stack:
>
> ----
>
> Traceback (most recent call last):
>  File "C:\Program Files\Google\google_appengine\google\appengine\tools
> \dev_appserver.py", line 3245, in _HandleRequest
>    self._Dispatch(dispatcher, self.rfile, outfile, env_dict)
>  File "C:\Program Files\Google\google_appengine\google\appengine\tools
> \dev_appserver.py", line 3186, in _Dispatch
>    base_env_dict=env_dict)
>  File "C:\Program Files\Google\google_appengine\google\appengine\tools
> \dev_appserver.py", line 531, in Dispatch
>    base_env_dict=base_env_dict)
>  File "C:\Program Files\Google\google_appengine\google\appengine\tools
> \dev_appserver.py", line 2410, in Dispatch
>    self._module_dict)
>  File "C:\Program Files\Google\google_appengine\google\appengine\tools
> \dev_appserver.py", line 2320, in ExecuteCGI
>    reset_modules = exec_script(handler_path, cgi_path, hook)
>  File "C:\Program Files\Google\google_appengine\google\appengine\tools
> \dev_appserver.py", line 2216, in ExecuteOrImportScript
>    exec module_code in script_module.__dict__
>  File "C:\Documents and Settings\robodoggy\My Documents\coolkevapp
> \MainPage.py", line 31, in <module>
>    class Person(db.Model):
>  File "C:\Documents and Settings\robodoggy\My Documents\coolkevapp
> \MainPage.py", line 33, in Person
>    groups = db.ListProperty(db.ReferenceProperty(Group))
>  File "C:\Program Files\Google\google_appengine\google\appengine\ext
> \db\__init__.py", line 2971, in __init__
>    raise TypeError('Item type should be a type object')
> TypeError: Item type should be a type object
>
> -----
>
> What I'm trying to do is to create a list of groups that each person
> belongs to. As you can see, it dislikes me having a list of Groups.
>
> Does anyone know an alternative way to do this?
>
> -----
>
> Sorry if I wasn't clear with something. Ask and I'll answer.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-appengine%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" 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/google-appengine?hl=en.

Reply via email to