File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -279,3 +279,32 @@ Or you can pass the change reason explicitly:
279
279
poll = Poll(question = ' Question 1' )
280
280
poll.save()
281
281
update_change_reason(poll, ' Add a question' )
282
+
283
+ Save Without Historical Record
284
+ ------------------------------
285
+
286
+ You want save model without saving a historical record. You can use this method.
287
+
288
+ .. code-block :: python
289
+ def save_without_historical_record (self , * args , ** kwargs ):
290
+ self .skip_history_when_saving = True
291
+ try :
292
+ ret = self .save(* args, ** kwargs)
293
+ finally :
294
+ del self .skip_history_when_saving
295
+ return ret
296
+
297
+
298
+ .. code-block :: python
299
+ class Poll (models .Model ):
300
+ question = models.CharField(max_length = 200 )
301
+ history = HistoricalRecords()
302
+
303
+
304
+ .. code-block :: python
305
+ poll = Poll(quetions = ' somthing' )
306
+ poll.save_without_historical_record()
307
+
308
+
309
+
310
+
You can’t perform that action at this time.
0 commit comments