def db_for_write(self, model, **hints):
        """
        If given some hints['instance'] that is saved in a db, use related
        fields from the same db. Otherwise if passed a class or instance to
        model, return the salesforce alias if it's a subclass of SalesforceModel.
        """
        if 'instance' in hints:
            db = hints['instance']._state.db
            if db:
                return db
        if getattr(model, '_salesforce_object', False):
            return self.sf_alias
def db_for_write ( self , model , ** hints ) : if 'instance' in hints : db = hints [ 'instance' ] . _state . db if db : return db if getattr ( model , '_salesforce_object' , False ) : return self . sf_alias
If given some hints['instance'] that is saved in a db, use related
        fields from the same db. Otherwise if passed a class or instance to
        model, return the salesforce alias if it's a subclass of SalesforceModel.