mirror of
https://github.com/jazzband/django-auditlog.git
synced 2026-03-16 22:20:26 +00:00
Fix documentation problem in usage.rst
This commit is contained in:
parent
7771075dc0
commit
6b60d04e44
1 changed files with 12 additions and 3 deletions
|
|
@ -21,9 +21,12 @@ your models to Auditlog is even easier than using signals.
|
|||
|
||||
Registering your model for logging can be done with a single line of code, as the following example illustrates::
|
||||
|
||||
from auditlog.registry import auditlog
|
||||
.. code-block:: python
|
||||
|
||||
from django.db import models
|
||||
|
||||
from auditlog.registry import auditlog
|
||||
|
||||
class MyModel(models.Model):
|
||||
pass
|
||||
# Model definition goes here
|
||||
|
|
@ -59,7 +62,12 @@ during the `register()` call.
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
class MyModel(modelsModel):
|
||||
from django.db import models
|
||||
|
||||
from auditlog.models import AuditlogHistoryField
|
||||
from auditlog.registry import auditlog
|
||||
|
||||
class MyModel(models.Model):
|
||||
sku = models.CharField(max_length=20)
|
||||
version = models.CharField(max_length=5)
|
||||
product = models.CharField(max_length=50, verbose_name='Product Name')
|
||||
|
|
@ -211,9 +219,10 @@ Auditlog ships with a custom field that enables you to easily get the log entrie
|
|||
functionality is built on Django's content types framework (:py:mod:`django.contrib.contenttypes`). Using this field in
|
||||
your models is equally easy as any other field::
|
||||
|
||||
from django.db import models
|
||||
|
||||
from auditlog.models import AuditlogHistoryField
|
||||
from auditlog.registry import auditlog
|
||||
from django.db import models
|
||||
|
||||
class MyModel(models.Model):
|
||||
history = AuditlogHistoryField()
|
||||
|
|
|
|||
Loading…
Reference in a new issue