2👍
Maybe this helps to understand the NDB. I had the same questions with you.
class Person(ndb.Expando):
pass
class Favourite(ndb.Expando):
pass
class Picture(ndb.Expando):
pass
person = Person()
person.put()
picture = Picture()
picture.put()
fav = Favourite(parent=person.key,
person=person.key,
picture=picture.key
)
fav.put()
- [Django]-What is the default range for IntegerFields on Django?
- [Django]-Django: Lowercasing filename of the input Image File
- [Django]-Django Media assets in Forms, how to defer/async JS assets?
- [Django]-Django-CMS: Multiple domains on same project
- [Django]-Is it possible to use a table in the database when it is NOT a Django model?
0👍
- Verify that shuffle works in this case, as User.query() returns an iter, not a list. (You can convert it to a list using shuffle( [ x for x in users ] ). Beware, this list could be looong.
- NDB has some really wired behavior sometimes, so id recommend you dont store an NDB-Key, but its serialized string, which is also compatible to ext.db: post.user_key = shuffle( [ x for x in users ] ).key.urlsafe()
- You could use KeyProperty for associations. If you need a more fine-graned control over your relations, you must implement them yourself.
See https://developers.google.com/appengine/docs/python/ndb/properties#structured
- [Django]-Django could not connect to server: Permission denied Is the server running on host and accepting TCP/IP connections on port remote host
- [Django]-Need to override django auto_now_add in pytest factory
Source:stackexchange.com