Skip to content

Commit a5721fd

Browse files
committed
Resolve the conflicts
2 parents 3100b03 + d76e446 commit a5721fd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1302
-432
lines changed

.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ charset = utf-8
88
indent_style = space
99
end_of_line = lf
1010
insert_final_newline = true
11+
max_line_length = 79
1112
trim_trailing_whitespace = true
1213

1314
[*.{py,rst,ini}]

.landscape.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
max-line-length: 79
12
uses:
2-
- Django
3+
- django

.travis.yml

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,38 @@
11
language: python
22

3+
sudo: false
4+
35
python:
4-
- 2.6
56
- 2.7
6-
- 3.2
77
- 3.3
8+
- 3.4
9+
- 3.5
810

911
env:
10-
- DJANGO="Django>=1.4,<1.5"
1112
- DJANGO="Django>=1.6,<1.7"
1213
- DJANGO="Django>=1.7,<1.8"
14+
- DJANGO="Django>=1.8,<1.9"
15+
- DJANGO="Django>=1.9,<1.10"
16+
- DJANGO="Django>=1.10,<1.11"
1317

1418
install:
15-
- pip install -U coverage coveralls $DJANGO
16-
- python -c 'from __future__ import print_function; import django; print("Django " + django.get_version())'
19+
- pip install -U coverage codecov
20+
- pip install -U $DJANGO
21+
- pip freeze
1722

18-
script: coverage run -a setup.py test
23+
script: coverage run setup.py test
1924

2025
matrix:
2126
exclude:
22-
- python: 2.6
27+
- python: 3.4
2328
env: DJANGO="Django>=1.6,<1.7"
24-
- python: 2.6
29+
- python: 3.5
30+
env: DJANGO="Django>=1.6,<1.7"
31+
- python: 3.5
2532
env: DJANGO="Django>=1.7,<1.8"
26-
- python: 3.2
27-
env: DJANGO="Django>=1.4,<1.5"
2833
- python: 3.3
29-
env: DJANGO="Django>=1.4,<1.5"
30-
31-
include:
32-
- python: 3.4
33-
env: DJANGO="Django>=1.7,<1.8"
34+
env: DJANGO="Django>=1.9,<1.10"
35+
- python: 3.3
36+
env: DJANGO="Django>=1.10,<1.11"
3437

35-
after_success: coveralls
38+
after_success: codecov

AUTHORS.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,38 @@ Authors
22
=======
33

44
- Aleksey Kladov
5+
- bradford281
6+
- Buddy Lindsey, Jr.
57
- Brian Dixon
68
- Corey Bertram
79
- Damien Nozay
810
- Daniel Levy
911
- Daniel Roschka
1012
- David Hite
1113
- George Vilches
14+
- Grzegorz Bialy
1215
- Hamish Downer
1316
- James Pulec
1417
- Joao Pedro Francese
1518
- jofusa
1619
- John Whitlock
20+
- Jonathan Leroy
1721
- Jonathan Sanchez
1822
- Josh Fyne
1923
- Klaas van Schelven
24+
- Martin Bachwerk
2025
- Marty Alchin
2126
- Mauricio de Abreu Antunes
2227
- Micah Denbraver
2328
- Rajesh Pappula
29+
- Rod Xavier Bondoc
2430
- Ross Lote
2531
- Steven Klass
2632
- Trey Hunner
2733
- Ulysses Vilela
2834
- vnagendra
29-
- hmit
35+
- Lucas Wiman
36+
- Michael England
3037

3138
Background
3239
==========

CHANGES.rst

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,52 @@ Changes
33

44
tip (unreleased)
55
----------------
6+
- Added --batchsize option to the populate_history management command.
7+
8+
1.8.2 (2017-01-19)
9+
------------------
10+
- Add Polish locale.
11+
- Add Django 1.10 support.
12+
13+
1.8.1 (2016-03-19)
14+
------------------
15+
- Clear the threadlocal request object when processing the response to prevent test interactions. (gh-213)
16+
17+
1.8.0 (2016-02-02)
18+
------------------
19+
- History tracking can be inherited by passing `inherit=True`. (gh-63)
20+
21+
1.7.0 (2015-12-02)
22+
------------------
23+
- Add ability to list history in admin when the object instance is deleted. (gh-72)
24+
- Add ability to change history through the admin. (Enabled with the `SIMPLE_HISTORY_EDIT` setting.)
25+
- Add Django 1.9 support.
26+
- Support for custom tables names. (gh-196)
27+
28+
1.6.3 (2015-07-30)
29+
------------------
30+
- Respect `to_field` and `db_column` parameters (gh-182)
31+
32+
1.6.2 (2015-07-04)
33+
------------------
34+
- Use app loading system and fix deprecation warnings on Django 1.8 (gh-172)
35+
- Update Landscape configuration
36+
37+
1.6.1 (2015-04-21)
38+
------------------
39+
- Fix OneToOneField transformation for historical models (gh-166)
40+
- Disable cascading deletes from related models to historical models
41+
- Fix restoring historical instances with missing one-to-one relations (gh-162)
42+
43+
1.6.0 (2015-04-16)
44+
------------------
45+
- Add support for Django 1.8+
46+
- Deprecated use of ``CustomForeignKeyField`` (to be removed)
47+
- Remove default reverse accessor to `auth.User` for historical models (gh-121)
48+
49+
1.5.4 (2015-01-03)
50+
------------------
51+
- Fix a bug when models have a ``ForeignKey`` with ``primary_key=True``
652
- Do NOT delete the history elements when a user is deleted.
753
- Add support for ``latest``
854
- Allow setting a reason for change. [using option changeReason]

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ clean-pyc:
1414
find . -name '*~' -exec rm -f {} +
1515

1616
init:
17-
pip install tox>=1.8 coverage Sphinx
17+
pip install "tox>=1.8" coverage Sphinx
1818

1919
test:
2020
coverage erase

README.rst

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,24 @@ django-simple-history
33

44
.. image:: https://secure.travis-ci.org/treyhunner/django-simple-history.png?branch=master
55
:target: http://travis-ci.org/treyhunner/django-simple-history
6-
.. image:: https://coveralls.io/repos/treyhunner/django-simple-history/badge.png?branch=master
7-
:target: https://coveralls.io/r/treyhunner/django-simple-history
8-
.. image:: https://pypip.in/v/django-simple-history/badge.png
9-
:target: https://crate.io/packages/django-simple-history
10-
.. image:: https://pypip.in/d/django-simple-history/badge.png
11-
:target: https://crate.io/packages/django-simple-history
6+
:alt: Build Status
7+
8+
.. image:: https://img.shields.io/codecov/c/github/treyhunner/django-simple-history/master.svg
9+
:target: http://codecov.io/github/treyhunner/django-simple-history?branch=master
10+
:alt: Test Coverage
11+
12+
.. image:: https://img.shields.io/pypi/v/django-simple-history.svg
13+
:target: https://pypi.python.org/pypi/django-simple-history
14+
:alt: PyPI Version
15+
1216
.. image:: https://landscape.io/github/treyhunner/django-simple-history/master/landscape.png
1317
:target: https://landscape.io/github/treyhunner/django-simple-history/master
1418
:alt: Code Health
1519

1620

1721
django-simple-history stores Django model state on every create/update/delete.
1822

19-
This app requires Django 1.4.2 or greater and Python 2.6 or greater.
23+
This app requires Django 1.6 or greater and Python 2.7, 3.3, or greater.
2024

2125
Getting Help
2226
------------
@@ -29,9 +33,3 @@ Pull requests are welcome. Read the CONTRIBUTING file for tips on
2933
submitting a pull request.
3034

3135
.. _PyPI: https://pypi.python.org/pypi/django-email-log/
32-
33-
34-
.. image:: https://d2weczhvl823v0.cloudfront.net/treyhunner/django-simple-history/trend.png
35-
:alt: Bitdeli badge
36-
:target: https://bitdeli.com/free
37-

docs/advanced.rst

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,35 @@ third-party apps you don't have control over. Here's an example of using
6565
register(User)
6666
6767
68+
Allow tracking to be inherited
69+
---------------------------------
70+
71+
By default history tracking is only added for the model that is passed
72+
to ``register()`` or has the ``HistoricalRecords`` descriptor. By
73+
passing ``inherit=True`` to either way of registering you can change
74+
that behavior so that any child model inheriting from it will have
75+
historical tracking as well. Be careful though, in cases where a model
76+
can be tracked more than once, ``MultipleRegistrationsError`` will be
77+
raised.
78+
79+
.. code-block:: python
80+
81+
from django.contrib.auth.models import User
82+
from django.db import models
83+
from simple_history import register
84+
from simple_history.models import HistoricalRecords
85+
86+
# register() example
87+
register(User, inherit=True)
88+
89+
# HistoricalRecords example
90+
class Poll(models.Model):
91+
history = HistoricalRecords(inherit=True)
92+
93+
Both ``User`` and ``Poll`` in the example above will cause any model
94+
inheriting from them to have historical tracking as well.
95+
96+
6897
.. recording_user:
6998
7099
Recording Which User Changed a Model
@@ -158,3 +187,29 @@ To change the auto-generated HistoricalRecord models base class from
158187
pub_date = models.DateTimeField('date published')
159188
changed_by = models.ForeignKey('auth.User')
160189
history = HistoricalRecords(bases=[RoutableModel])
190+
191+
Custom history table name
192+
-------------------------
193+
194+
By default, the table name for historical models follow the Django convention
195+
and just add ``historical`` before model name. For instance, if your application
196+
name is ``polls`` and your model name ``Question``, then the table name will be
197+
``polls_historicalquestion``.
198+
199+
You can use the ``table_name`` parameter with both ``HistoricalRecords()`` or
200+
``register()`` to change this behavior.
201+
202+
.. code-block:: python
203+
204+
class Question(models.Model):
205+
question_text = models.CharField(max_length=200)
206+
pub_date = models.DateTimeField('date published')
207+
history = HistoricalRecords(table_name='polls_question_history')
208+
209+
.. code-block:: python
210+
211+
class Question(models.Model):
212+
question_text = models.CharField(max_length=200)
213+
pub_date = models.DateTimeField('date published')
214+
215+
register(Question, table_name='polls_question_history')

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595

9696
# The theme to use for HTML and HTML Help pages. See the documentation for
9797
# a list of builtin themes.
98-
html_theme = 'default'
98+
# html_theme = 'default'
9999

100100
# Theme options are theme-specific and customize the look and feel of a theme
101101
# further. For a list of options available for each theme, see the

docs/usage.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ settings:
3737

3838
.. code-block:: python
3939
40-
MIDDLEWARE_CLASSES = [
40+
MIDDLEWARE = [
4141
# ...
4242
'simple_history.middleware.HistoryRequestMiddleware',
4343
]
4444
4545
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`.
46+
the user making the change as documented in :doc:`/advanced`.
4747

4848
Models
4949
~~~~~~
@@ -83,6 +83,9 @@ initial change for preexisting model instances:
8383
8484
$ python manage.py populate_history --auto
8585
86+
By default, history rows are inserted in batches of 200. This can be changed if needed for large tables
87+
by using the ``--batchsize`` option, for example ``--batchsize 500``.
88+
8689
.. _admin_integration:
8790

8891
Integration with Django Admin
@@ -121,7 +124,7 @@ An example of admin integration for the ``Poll`` and ``Choice`` models:
121124
admin.site.register(Poll, SimpleHistoryAdmin)
122125
admin.site.register(Choice, SimpleHistoryAdmin)
123126
124-
Changing a history-tracked model from the admin interface will automatically record the user who made the change (see :ref:`recording_user`).
127+
Changing a history-tracked model from the admin interface will automatically record the user who made the change (see :doc:`/advanced`).
125128

126129

127130
Querying history
@@ -168,3 +171,6 @@ records for all ``Choice`` instances can be queried by using the manager on the
168171
<simple_history.manager.HistoryManager object at 0x1cc4290>
169172
>>> Choice.history.all()
170173
[<HistoricalChoice: Choice object as of 2010-10-25 18:05:12.183340>, <HistoricalChoice: Choice object as of 2010-10-25 18:04:59.047351>]
174+
175+
Because the history is model, you can also filter it like regularly QuerySets,
176+
a.k. Choice.history.filter(choice_text='Not Much') will work!

0 commit comments

Comments
 (0)