Usercreated column in AppEngine
-
12-09-2019 - |
Question
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?
Solution
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.
OTHER TIPS
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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow