How to make a UserProperty in the ndb Model

53 views
Skip to first unread message

Yash Raj Singh

unread,
Oct 21, 2013, 9:02:20 AM10/21/13
to gae-sim...@googlegroups.com
Hello Alex,

I am working on a web-app which have few tables and i am making use of your SimpleAuth to get users on-board the app, what i want is a UserProperty() type property for a class model.

An example would be...

Like right it is like:

class Projects(ndb.Model):
    author = ndb.StringProperty()
    link = ndb.StringProperty()
    firm = ndb.IntegerProperty()
    content = ndb.StringProperty()
    picture = ndb.StringProperty()
    pty = ndb.IntegerProperty()
    deadline = ndb.DateTimeProperty()
    date = ndb.DateTimeProperty(auto_now_add=True)

what i want to have is:

class Projects(ndb.Model):
    admin = ndb.UserProperty()
    members = ndb.UserProperty(repeated=True)

    link = ndb.StringProperty()
    firm = ndb.IntegerProperty()
    content = ndb.StringProperty()
    picture = ndb.StringProperty()
    pty = ndb.IntegerProperty()
    deadline = ndb.DateTimeProperty()
    date = ndb.DateTimeProperty(auto_now_add=True)

How can i access the 'User' table of the simpleauth app and have a unique identifier for every user in 'User' table.

Regards,
Yash
Reply all
Reply to author
Forward
0 new messages