May 2018
Beginner to intermediate
526 pages
11h 57m
English
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:
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, ...
Read now
Unlock full access