Simple example:

#This prints valid key value
logging.info("Before AuthorArtist adding, author is: %s" %
video.author.key())

aa = AuthorArtists.get_or_insert("aa%s_%s" % (artist.name.lower
(),video.author.username.lower()),
                                                artist = artist,
                                                author = video.author)

#This gives error: ReferenceProperty failed to be resolved, because it
can't find author
logging.info("After AuthorArtist adding, AuthorArtist connection is:
%s" % aa.author.key())

Ok, let's look at our AuthorArtist object in Data Viewer. In author
field it have key
'ag9tdXNpY3ZpZGVvYnVnZXJyHAsSBkF1dGhvciIQYWRvbWlub3JlY29yZHMgCQw'. I
don't know what is it. db.get(this_ket) gives nothing. WTF?)

i have models:
class Author(db.Model):
    name    = db.StringProperty(required = True)
    .....

class Video(db.Model):
    videoid     = db.StringProperty(required = True)
    artist        = db.ReferenceProperty(Artist, collection_name =
"videos")
    author      = db.ReferenceProperty(Author, collection_name =
"videos")
    ...

class Artist(db.Model):
    name        = db.StringProperty()
    ...

class AuthorArtists(db.Model):
    author      = db.ReferenceProperty(Author)
    artist        = db.ReferenceProperty(Artist)
--~--~---------~--~----~------------~-------~--~----~
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 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to