{{{
if 'db_type' not in extra_context:
extra_context['db_type'] = self._output_field.db_type(connection)
}}}
Here self._output_field is a class instead of instance. So we either must
pass an instance of field like
{{{
value = Value.objects.annotate(as_float=Cast('integer',
FloatField())).get()
}}}
and point to it in docs or create instance inside `as_sql` like this:
{{{
extra_context['db_type'] = self._output_field().db_type(connection)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27209>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => assigned
* needs_better_patch: => 0
* component: Database layer (models, ORM) => Documentation
* needs_tests: => 0
* version: 1.10 => master
* owner: nobody => charettes
* needs_docs: => 0
* type: Bug => Cleanup/optimization
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/27209#comment:1>
Comment (by charettes):
Here's a [https://github.com/django/django/pull/7234 PR] with the
documentation adjustments.
--
Ticket URL: <https://code.djangoproject.com/ticket/27209#comment:2>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/27209#comment:3>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"767ba009764c6640b20ea6a6dc6ee2559cc87800" 767ba009]:
{{{
#!CommitTicketReference repository=""
revision="767ba009764c6640b20ea6a6dc6ee2559cc87800"
Fixed #27209 -- Fixed typo in docs/ref/models/database-functions.txt.
Thanks Valentin Ignatyev for the report.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27209#comment:4>
Comment (by Tim Graham <timograham@…>):
In [changeset:"23cf7e50d1dfceb0836032d0e8fcf1fa4da7e855" 23cf7e5]:
{{{
#!CommitTicketReference repository=""
revision="23cf7e50d1dfceb0836032d0e8fcf1fa4da7e855"
[1.10.x] Fixed #27209 -- Fixed typo in docs/ref/models/database-
functions.txt.
Thanks Valentin Ignatyev for the report.
Backport of 767ba009764c6640b20ea6a6dc6ee2559cc87800 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27209#comment:5>