mirror of
https://github.com/jazzband/django-auditlog.git
synced 2026-03-16 22:20:26 +00:00
update docs (#662)
This commit is contained in:
parent
2958f58acd
commit
07a3a83828
1 changed files with 16 additions and 0 deletions
|
|
@ -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**
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue