Sunday, May 1, 2011

Usercreated column in AppEngine

Imagine you have a column called

usercreated = db.ReferenceProperty(User)

And you want this field to automaticly filled when first putted to store. Like this did for auto_date. Is this possible?

From stackoverflow
  • According to the docs, your best bet is going to be a redefinition of the property class you're working with in order to override the default_value() method. You could also try duckpunching, though it's probably not a viable option.

  • The User property type has an auto_current_user flag, which is an easy solution if your using google accounts for authentication.

    http://code.google.com/appengine/docs/python/datastore/typesandpropertyclasses.html#UserProperty

    dynback.com : right, I simply use my own. And already create the same implement, as they do, only for Reference

0 comments:

Post a Comment