Changes between Version 2 and Version 6 of Ticket #32563
- Timestamp:
- Mar 18, 2021, 3:14:50 AM (4 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #32563 – Description
v2 v6 70 70 I noticed that all the methods of ''RelatedManager'' directly call the router object to find the database while the ''Manager'' objects always exploits the possibility of overriding the database with the call to ''using()'' on the QuerySet or to pass parameter ''using=db'' for save model method for example. 71 71 72 I guess we need to use a mecanism which we can find in Model class with the save method : 73 {{{ 74 def save(self, force_insert=False, force_update=False, using=None, 75 update_fields=None): 76 [...] 77 using = using or router.db_for_write(self.__class__, instance=self) 78 [...] 79 }}} 80 81 Thus, we will be able to override the database at the time of the save. 72 82 73 83 Thank you in advance for your answer