Skip to content

Commit 07a3a83

Browse files
update docs (#662)
1 parent 2958f58 commit 07a3a83

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

docs/source/usage.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,22 @@ A DetailView utilizing the LogAccessMixin could look like the following example:
5555
5656
# View code goes here
5757
58+
You can also add log-access to function base views, as the following example illustrates:
59+
60+
.. code-block:: python
61+
62+
from auditlog.signals import accessed
63+
64+
def profile_view(request, pk):
65+
## get the object you want to log access
66+
user = User.objects.get(pk=pk)
67+
68+
## log access
69+
accessed.send(user.__class__, instance=user)
70+
71+
# View code goes here
72+
...
73+
5874
5975
**Excluding fields**
6076

0 commit comments

Comments
 (0)