From 07a3a83828a03ff4479bafe632dc8921f7a87d6d Mon Sep 17 00:00:00 2001 From: Mohsin Raza Date: Thu, 1 Aug 2024 13:33:40 +0500 Subject: [PATCH] update docs (#662) --- docs/source/usage.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/source/usage.rst b/docs/source/usage.rst index 8cabfbff..843c189d 100644 --- a/docs/source/usage.rst +++ b/docs/source/usage.rst @@ -55,6 +55,22 @@ A DetailView utilizing the LogAccessMixin could look like the following example: # View code goes here +You can also add log-access to function base views, as the following example illustrates: + +.. code-block:: python + + from auditlog.signals import accessed + + def profile_view(request, pk): + ## get the object you want to log access + user = User.objects.get(pk=pk) + + ## log access + accessed.send(user.__class__, instance=user) + + # View code goes here + ... + **Excluding fields**