Commit 9a1fcf1533db1dc6eb2b6871d7463d665126f513
1 parent
d1312d97db
Exists in
master
Fixed PostgresIntervalDay's __init__
Showing 1 changed file with 4 additions and 4 deletions Side-by-side Diff
flashcards/models.py
View file @
9a1fcf1
... | ... | @@ -483,18 +483,18 @@ |
483 | 483 | super(JulianDay, self).__init__(expression, output_field=output, **extra) |
484 | 484 | |
485 | 485 | |
486 | -class EncapsulateIntervalDay(Func): | |
486 | +class PostgresIntervalDay(Func): | |
487 | 487 | function = 'EXTRACT' |
488 | 488 | template_postgres = "(((%(function)s(EPOCH FROM INTERVAL %(expressions)s) / 60) / 60) / 24)::integer" |
489 | 489 | arg_joiner = ' - ' |
490 | 490 | |
491 | - def __init__(self, expression, **extra): | |
491 | + def __init__(self, *expression, **extra): | |
492 | 492 | output = extra.pop('output_field', FloatField()) |
493 | - super(EncapsulateIntervalDay, self).__init__(expression, output_field=output, **extra) | |
493 | + super(PostgresIntervalDay, self).__init__(*expression, output_field=output, **extra) | |
494 | 494 | |
495 | 495 | |
496 | 496 | def interval_days(expression1, expression2): |
497 | 497 | if IN_PRODUCTION: |
498 | - return EncapsulateIntervalDay(expression1, expression2) | |
498 | + return PostgresIntervalDay(expression1, expression2) | |
499 | 499 | return JulianDay(expression1) - JulianDay(expression2) |