From the course: Securing Django Applications

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Adding activity logs for auditing

Adding activity logs for auditing - Django Tutorial

From the course: Securing Django Applications

Start my 1-month free trial

Adding activity logs for auditing

- [Instructor] Whenever a user changed some model in our system, we want to make sure that we log this action. The idea is that if there ever is a need for auditing, we have a log of activity that took place on the user's account or on their data. We start by creating the activity log model. The user is a foreign key to the user instance that modified or updated or performed whatever action it is we're logging here. And the action is a description of the action that took place. So, whenever we save a booking, we're going to be creating an activity log. The user is the user who created the booking, and then we actually create the activity log, and the action description will be user with an ID and email address, saved a booking with this particular ID. So we have the user ID, their email address, and then the booking ID. And then we add the activity log model to the Jango admin. Create the activity log model admin as…

Contents