Skip to content

Commit 8de29b4

Browse files
dgilgeRoss Mechanic
authored andcommitted
Document some register attributes (#417)
* Document some register attributes * HistoricalRecords isn't a model * Remove empty last line
1 parent 1ba64f7 commit 8de29b4

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

docs/advanced.rst

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,23 @@ third-party apps you don't have control over. Here's an example of using
6464
6565
register(User)
6666
67+
If you want to separate the migrations of the historical model from those of
68+
the third-party model itself you can pass a module as ``app`` attribute to
69+
``register``. For instance, if the migrations shall live in the migrations
70+
folder of the package you register the model in, you could do:
71+
72+
.. code-block:: python
73+
74+
register(User, app=__package__)
75+
76+
You can pass attributes of ``HistoricalRecords`` directly to ``register``:
77+
78+
.. code-block:: python
79+
80+
register(User, excluded_fields=['last_login']))
81+
82+
For a complete list of the attributes you can pass to ``register`` we refer
83+
to the source code.
6784

6885
Allow tracking to be inherited
6986
---------------------------------
@@ -428,4 +445,4 @@ This may be useful when you want to construct timelines and need to get only the
428445
new_record, old_record = p.history.all()
429446
delta = new_record.diff_against(old_record)
430447
for change in delta.changes:
431-
print("{} changed from {} to {}".format(change.field, change.old, change.new))
448+
print("{} changed from {} to {}".format(change.field, change.old, change.new))

0 commit comments

Comments
 (0)