1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00

Avoided need to import model fields in models/functions.py.

This commit is contained in:
Claude Paroz 2016-03-25 18:49:45 -04:00 committed by Tim Graham
parent fb84e877ce
commit fc01c84bad

View File

@ -1,9 +1,7 @@
"""
Classes that represent database functions.
"""
from django.db.models import (
DateTimeField, Func, IntegerField, Transform, Value,
)
from django.db.models import Func, Transform, Value, fields
class Coalesce(Func):
@ -136,7 +134,7 @@ class Length(Transform):
lookup_name = 'length'
def __init__(self, expression, **extra):
output_field = extra.pop('output_field', IntegerField())
output_field = extra.pop('output_field', fields.IntegerField())
super(Length, self).__init__(expression, output_field=output_field, **extra)
def as_mysql(self, compiler, connection):
@ -153,7 +151,7 @@ class Now(Func):
def __init__(self, output_field=None, **extra):
if output_field is None:
output_field = DateTimeField()
output_field = fields.DateTimeField()
super(Now, self).__init__(output_field=output_field, **extra)
def as_postgresql(self, compiler, connection):