Database Reference
In-Depth Information
result = query.execute(**params)
for r in result:
setattr(r, "timestampAsStr",
datetime.fromtimestamp(int(r.timestamp)).strftime('%m/%d/%Y') + " at " +
datetime.fromtimestamp(int(r.timestamp)).strftime('%I:%M %p')
)
return result
Editing a Status Update
When status updates are displayed, the current user's status updates will contain a link to “Edit” the status. Once
clicked, it will open the form, similar to the “Add Content” link, but will populate the form with the status update
values and modify the form button to read “Edit Content”, as shown in Figure
9-11
. As with many similar UI features,
clicking “Cancel” under the heading will remove the values and return the form to its ready state.
Figure 9-11.
Editing a status update
The
edit
feature, like the
add
feature, uses a route in the
graphstory
application and a function in
graphstory.js
,
which are
edit_
and
updateContent
, respectively. The
edit_content
route passes in the content object, with its
content id, and then calls the
edit_content
method in
Content
class, as shown in Listing 9-30.