It's time to add some actions to our views to build the activity stream for our users. We will store an action for each of the following interactions:
- A user bookmarks an image
- A user likes an image
- A user creates an account
- A user starts following another user
Edit the views.py file of the images application and add the following import:
from actions.utils import create_action
In the image_create view, add create_action() after saving the image, like this:
new_item.save()create_action(request.user, 'bookmarked image', new_item)
In the image_like view, add create_action() after adding the user to the users_like relationship, as follows:
image.users_like.add(request.user)create_action(request.user, ...