answering my own question, I mistakenly reversed table names. Here is
correct, working version:
# Update objectDisplayName in db.SuperObject whenever
db.Suggestion.suggestionTitle is updated
def update_SuggestionDisplayName(set, ufields):
table = 'Suggestion' if ('suggestionTitle' in ufields) else None
if table:
name_format = '%(suggestionTitle)s'
records = set.select()
for record in records:
displayName = name_format % record
ThisSuperObject = db(db.Suggestion.id ==
record.id).select(db.Suggestion.objectID).first()
db(db.SuperObject.id ==
ThisSuperObject.objectID).update(objectDisplayName=displayName)
db.Suggestion._after_update.append(update_SuggestionDisplayName)
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.