1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Added support for modifying the effect of `DISTINCT` clauses so they

only consider some fields (PostgreSQL only).

For this, the ``distinct()`` QuerySet method now accepts an optional
list of model fields names and generates ``DISTINCT ON`` clauses on
these cases. Thanks Jeffrey Gelens and Anssi Kääriäinen for their work.

Fixes #6422.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17244 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Ramiro Morales
2011-12-22 20:42:40 +00:00
parent 03eb2907d5
commit 287565779d
16 changed files with 374 additions and 43 deletions

View File

@@ -498,6 +498,16 @@ Django 1.4 also includes several smaller improvements worth noting:
``pickle.HIGHEST_PROTOCOL`` for better compatibility with the other
cache backends.
* Support in the ORM for generating ``SELECT`` queries containing ``DISTINCT ON``
The ``distinct()`` ``Queryset`` method now accepts an optional list of model
field names. If specified, then the ``DISTINCT`` statement is limited to these
fields. The PostgreSQL is the only of the database backends shipped with
Django that supports this new functionality.
For more details, see the documentation for
:meth:`~django.db.models.query.QuerySet.distinct`.
.. _backwards-incompatible-changes-1.4:
Backwards incompatible changes in 1.4