def value_to_db_decimal(self, value, max_digits, decimal_places): """ Transform a decimal.Decimal value to an object compatible with what is expected by the backend driver for decimal (numeric) columns. """ if value is None: return None return util.format_number(value, max_digits, decimal_places)
def format_number(self, value): """ Formats a number into a string with the requisite number of digits and decimal places. """ # Method moved to djangocg.db.backends.util. # # It is preserved because it is used by the oracle backend # (djangocg.db.backends.oracle.query), and also for # backwards-compatibility with any external code which may have used # this method. from djangocg.db.backends import util return util.format_number(value, self.max_digits, self.decimal_places)