You can generate random numbers with some prefix, for example c123, c221, c5...
2011/12/15 Arthur Wiebe <arto...@gmail.com> > I have a multi tenant scenario where I want to set a namespace by company. > > Here's what I'm planning to do: > > 1) User login to app > 2) The User entity has a reference to the company the user is part of. > 3) The app sets the namespace to the key() of the company entity. > > Here's what it kinda looks like in code: (stripped down version) > > class Company(db.Model): > company = db.StringProperty() > > class User(db.Model): > user = db.UserProperty() > company = db.ReferenceProperty(Company) > > user = users.get_current_user() > > q = User.gql('WHERE user = :1', user) > if (q.count() == 1): > u = q.get() > namespace_manager.set_namespace(u.company.key()) > > ----------------------------------------- > > The reason I want to use something like the key as the namespace is > because I want users to be able to change their company name. And while > technically of course we could use a google apps domain, we do not require > clients to be on google apps, they could use gmail.com accounts for > example. > > Does this system make sense to you guys? I'm still learning with app > engine and Python, so just wanted to run it by some seasoned experts. > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/google-appengine/-/T2avwmOhcEcJ. > 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. > -- Blog: www.rekby.ru -- 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.