File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -68,8 +68,11 @@ def warn_if_repeatable_read(self):
6868 if isolation == 'REPEATABLE-READ' :
6969 warnings .warn (TxIsolationWarning (W_ISOLATION_REP .strip ()))
7070
71+ def database_for_write (self ):
72+ return router .db_for_write (self .model )
73+
7174 def connection_for_write (self ):
72- return connections [router . db_for_write ( self .model )]
75+ return connections [self .database_for_write ( )]
7376
7477 def connection_for_read (self ):
7578 return connections [self .db ]
@@ -86,7 +89,7 @@ def get_all_expired(self, expires):
8689
8790 def delete_expired (self , expires ):
8891 """Delete all expired results."""
89- with transaction .atomic (using = self .db ):
92+ with transaction .atomic (using = self .database_for_write () ):
9093 raw_delete (queryset = self .get_all_expired (expires ))
9194
9295
You can’t perform that action at this time.
0 commit comments