1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #20826 -- Moved Manager.raw() and Manager._insert() to the QuerySet class.

This commit is contained in:
Loic Bistuer
2013-07-29 16:47:49 +07:00
committed by Tim Graham
parent a3a59a3197
commit acd1d439fd
4 changed files with 49 additions and 20 deletions

View File

@@ -1262,6 +1262,28 @@ unexpectedly blocking.
Using ``select_for_update`` on backends which do not support
``SELECT ... FOR UPDATE`` (such as SQLite) will have no effect.
raw
~~~
.. method:: raw(raw_query, params=None, translations=None)
.. versionchanged:: 1.7
``raw`` was moved to the ``QuerySet`` class. It was previously only on
:class:`~django.db.models.Manager`.
Takes a raw SQL query, executes it, and returns a
``django.db.models.query.RawQuerySet`` instance. This ``RawQuerySet`` instance
can be iterated over just like an normal QuerySet to provide object instances.
See the :ref:`executing-raw-queries` for more information.
.. warning::
``raw()`` always triggers a new query and doesn't account for previous
filtering. As such, it should generally be called from the ``Manager`` or
from a fresh ``QuerySet`` instance.
Methods that do not return QuerySets
------------------------------------