File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -213,3 +213,29 @@ You can use the ``table_name`` parameter with both ``HistoricalRecords()`` or
213
213
pub_date = models.DateTimeField(' date published' )
214
214
215
215
register(Question, table_name = ' polls_question_history' )
216
+
217
+ Choosing fields to not be stored
218
+ --------------------------------
219
+
220
+ It is possible to use the parameter ``excluded_fields `` to choice which fields
221
+ will be stored on every create/update/delete.
222
+
223
+ For example, if you have the model:
224
+
225
+ .. code-block :: python
226
+
227
+ class PollWithExcludeFields (models .Model ):
228
+ question = models.CharField(max_length = 200 )
229
+ pub_date = models.DateTimeField(' date published' )
230
+
231
+ And you don't want to stored the changes for the field ``pub_date ``, it is necessary to update the model to:
232
+
233
+ .. code-block :: python
234
+
235
+ class PollWithExcludeFields (models .Model ):
236
+ question = models.CharField(max_length = 200 )
237
+ pub_date = models.DateTimeField(' date published' )
238
+
239
+ history = HistoricalRecords(excluded_fields = [' pub_date' ])
240
+
241
+ By default, django-simple-history stores the changes for all fields in the model.
You can’t perform that action at this time.
0 commit comments