mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
[1.8.x] Refs #24485 -- Renamed some expression types
Backport of 88d798d71a from master
This commit is contained in:
@@ -284,9 +284,9 @@ should define the desired ``output_field``. For example, adding an
|
||||
arithmetic between different types, it's necessary to surround the
|
||||
expression in another expression::
|
||||
|
||||
from django.db.models import DateTimeField, ExpressionNode, F
|
||||
from django.db.models import DateTimeField, Expression, F
|
||||
|
||||
Race.objects.annotate(finish=ExpressionNode(
|
||||
Race.objects.annotate(finish=Expression(
|
||||
F('start') + F('duration'), output_field=DateTimeField()))
|
||||
|
||||
.. versionchanged:: 1.8
|
||||
@@ -369,13 +369,13 @@ Expression API
|
||||
|
||||
Query expressions implement the :ref:`query expression API <query-expression>`,
|
||||
but also expose a number of extra methods and attributes listed below. All
|
||||
query expressions must inherit from ``ExpressionNode()`` or a relevant
|
||||
query expressions must inherit from ``Expression()`` or a relevant
|
||||
subclass.
|
||||
|
||||
When a query expression wraps another expression, it is responsible for
|
||||
calling the appropriate methods on the wrapped expression.
|
||||
|
||||
.. class:: ExpressionNode
|
||||
.. class:: Expression
|
||||
|
||||
.. attribute:: contains_aggregate
|
||||
|
||||
@@ -489,9 +489,9 @@ We'll start by defining the template to be used for SQL generation and
|
||||
an ``__init__()`` method to set some attributes::
|
||||
|
||||
import copy
|
||||
from django.db.models import ExpressionNode
|
||||
from django.db.models import Expression
|
||||
|
||||
class Coalesce(ExpressionNode):
|
||||
class Coalesce(Expression):
|
||||
template = 'COALESCE( %(expressions)s )'
|
||||
|
||||
def __init__(self, expressions, output_field, **extra):
|
||||
|
||||
Reference in New Issue
Block a user