Skip to content

Commit 110ec14

Browse files
committed
Restructured the quickstart documentation
1 parent 652f944 commit 110ec14

File tree

2 files changed

+35
-21
lines changed

2 files changed

+35
-21
lines changed

docs/advanced.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ third-party apps you don't have control over. Here's an example of using
6565
register(User)
6666
6767
68-
.. _recording_user:
68+
.. recording_user:
6969
7070
Recording Which User Changed a Model
7171
------------------------------------

docs/usage.rst

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Usage
2-
=====
1+
Quick Start
2+
===========
33

44
Install
55
-------
@@ -16,10 +16,37 @@ Install from PyPI with ``pip``:
1616
.. _crate.io: https://crate.io/packages/django-simple-history/
1717

1818

19-
Quickstart
20-
----------
19+
Configure
20+
---------
2121

22-
Add ``simple_history`` to your ``INSTALLED_APPS``.
22+
Settings
23+
~~~~~~~~
24+
25+
Add ``simple_history`` to your ``INSTALLED_APPS``
26+
27+
.. code-block:: python
28+
29+
INSTALLED_APPS = [
30+
# ...
31+
'simple_history',
32+
]
33+
34+
The historical models can track who made each change. To populate the
35+
history user automatically you can add middleware to your Django
36+
settings:
37+
38+
.. code-block:: python
39+
40+
MIDDLEWARE_CLASSES = [
41+
# ...
42+
'simple_history.middleware.HistoryRequestMiddleware',
43+
]
44+
45+
If you do not want to use the middleware, you can explicitly indicate
46+
the user making the change as documented in :ref:`recording_user`.
47+
48+
Models
49+
~~~~~~
2350

2451
To track history for a model, create an instance of
2552
``simple_history.models.HistoricalRecords`` on the model.
@@ -46,20 +73,8 @@ Django tutorial:
4673
Now all changes to ``Poll`` and ``Choice`` model instances will be tracked in
4774
the database.
4875

49-
The historical models can also track who made each change. To populate
50-
the history user automatically you can add middleware to your Django
51-
settings:
52-
53-
.. code-block:: python
54-
55-
MIDDLEWARE_CLASSES = [
56-
# ...
57-
'simple_history.middleware.HistoryRequestMiddleware',
58-
]
59-
60-
If you do not want to use the middleware, you can explicitly indicate
61-
the user making the change as indicated in the advanced usage
62-
documentation.
76+
Existing Projects
77+
~~~~~~~~~~~~~~~~~
6378

6479
For existing projects, you can call the populate command to generate an
6580
initial change for preexisting model instances:
@@ -153,4 +168,3 @@ records for all ``Choice`` instances can be queried by using the manager on the
153168
<simple_history.manager.HistoryManager object at 0x1cc4290>
154169
>>> Choice.history.all()
155170
[<HistoricalChoice: Choice object as of 2010-10-25 18:05:12.183340>, <HistoricalChoice: Choice object as of 2010-10-25 18:04:59.047351>]
156-

0 commit comments

Comments
 (0)