@@ -435,22 +435,17 @@ def post_save(self, instance, created, using=None, **kwargs):
435
435
if not created and hasattr (instance , "skip_history_when_saving" ):
436
436
return
437
437
if not kwargs .get ("raw" , False ):
438
- self .create_historical_record (
439
- instance ,
440
- created and "+" or "~" ,
441
- using = using if self .use_base_model_db else None ,
442
- )
438
+ self .create_historical_record (instance , created and "+" or "~" , using = using )
443
439
444
440
def post_delete (self , instance , using = None , ** kwargs ):
445
441
if self .cascade_delete_history :
446
442
manager = getattr (instance , self .manager_name )
447
443
manager .using (using ).all ().delete ()
448
444
else :
449
- self .create_historical_record (
450
- instance , "-" , using = using if self .use_base_model_db else None
451
- )
445
+ self .create_historical_record (instance , "-" , using = using )
452
446
453
447
def create_historical_record (self , instance , history_type , using = None ):
448
+ using = using if self .use_base_model_db else None
454
449
history_date = getattr (instance , "_history_date" , now ())
455
450
history_user = self .get_history_user (instance )
456
451
history_change_reason = getattr (instance , "changeReason" , None )
0 commit comments