File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -156,3 +156,30 @@ So if we have:
156
156
157
157
the ``instance `` field will not actually be tracked on the history table because it's
158
158
in the reserved set of terms.
159
+
160
+ Multi-table Inheritance
161
+ -----------------------
162
+
163
+ ``django-simple-history `` supports tracking history on models that use multi-table
164
+ inheritance, such as:
165
+
166
+ .. code-block :: python
167
+
168
+ class ParentModel (models .Model ):
169
+ parent_field = models.CharField(max_length = 255 )
170
+ history = HistoricalRecords()
171
+
172
+ class ChildModel (ParentModel ):
173
+ child_field = models.CharField(max_length = 255 )
174
+ history = HistoricalRecords()
175
+
176
+
177
+ A few notes:
178
+
179
+ - On the child model, the ``HistoricalRecords `` instance is not inherited from the parent
180
+ model. This means that you can choose to track changes on just the parent model, just
181
+ the child model, or both.
182
+ - The child's history table contains all fields from the child model as well as all the
183
+ fields from the parent model.
184
+ - Updating a child instance only updates the child's history table, not the parent's
185
+ history table.
You can’t perform that action at this time.
0 commit comments