Kaydet (Commit) db613f4f authored tarafından Sergey Fedoseev's avatar Sergey Fedoseev Kaydeden (comit) Tim Graham

Refs #14030 -- Updated docs per "Improved expression support for python values."

Complements e2d6e146.
üst abec15ad
...@@ -70,7 +70,6 @@ Keep in mind that each of these values can be an expression. ...@@ -70,7 +70,6 @@ Keep in mind that each of these values can be an expression.
:class:`~django.db.models.Model` has a field named ``then``. This can be :class:`~django.db.models.Model` has a field named ``then``. This can be
resolved in two ways:: resolved in two ways::
>>> from django.db.models import Value
>>> When(then__exact=0, then=1) >>> When(then__exact=0, then=1)
>>> When(Q(then=0), then=1) >>> When(Q(then=0), then=1)
...@@ -116,8 +115,8 @@ A simple example:: ...@@ -116,8 +115,8 @@ A simple example::
``Case()`` accepts any number of ``When()`` objects as individual arguments. ``Case()`` accepts any number of ``When()`` objects as individual arguments.
Other options are provided using keyword arguments. If none of the conditions Other options are provided using keyword arguments. If none of the conditions
evaluate to ``TRUE``, then the expression given with the ``default`` keyword evaluate to ``TRUE``, then the expression given with the ``default`` keyword
argument is returned. If no ``default`` argument is provided, ``Value(None)`` argument is returned. If a ``default`` argument isn't provided, ``None`` is
is used. used.
If we wanted to change our previous query to get the discount based on how long If we wanted to change our previous query to get the discount based on how long
the ``Client`` has been with us, we could do so using lookups:: the ``Client`` has been with us, we could do so using lookups::
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment