From 9a1fcf1533db1dc6eb2b6871d7463d665126f513 Mon Sep 17 00:00:00 2001 From: Rohan Rangray <rrangray@ucsd.edu> Date: Fri, 29 May 2015 15:56:26 -0700 Subject: [PATCH] Fixed PostgresIntervalDay's __init__ --- flashcards/models.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flashcards/models.py b/flashcards/models.py index 809fb61..ea9f165 100644 --- a/flashcards/models.py +++ b/flashcards/models.py @@ -483,17 +483,17 @@ class JulianDay(Func): super(JulianDay, self).__init__(expression, output_field=output, **extra) -class EncapsulateIntervalDay(Func): +class PostgresIntervalDay(Func): function = 'EXTRACT' template_postgres = "(((%(function)s(EPOCH FROM INTERVAL %(expressions)s) / 60) / 60) / 24)::integer" arg_joiner = ' - ' - def __init__(self, expression, **extra): + def __init__(self, *expression, **extra): output = extra.pop('output_field', FloatField()) - super(EncapsulateIntervalDay, self).__init__(expression, output_field=output, **extra) + super(PostgresIntervalDay, self).__init__(*expression, output_field=output, **extra) def interval_days(expression1, expression2): if IN_PRODUCTION: - return EncapsulateIntervalDay(expression1, expression2) + return PostgresIntervalDay(expression1, expression2) return JulianDay(expression1) - JulianDay(expression2) -- 1.9.1