Ejemplo n.º 1
0
 def as_oracle(self, compiler, connection):
     if self.output_field.get_internal_type() == 'DurationField':
         expression = self.get_source_expressions()[0]
         from django.db.backends.oracle.functions import IntervalToSeconds, SecondsToInterval
         return compiler.compile(
             SecondsToInterval(Sum(IntervalToSeconds(expression))))
     return super().as_sql(compiler, connection)
Ejemplo n.º 2
0
 def as_oracle(self, compiler, connection, **extra_context):
     if self.output_field.get_internal_type() == 'DurationField':
         expression = self.get_source_expressions()[0]
         options = self._get_repr_options()
         from django.db.backends.oracle.functions import IntervalToSeconds, SecondsToInterval
         return compiler.compile(
             SecondsToInterval(
                 self.__class__(IntervalToSeconds(expression), **options)))
     return super().as_sql(compiler, connection, **extra_context)