django-modelcluster
django-modelcluster copied to clipboard
Implement QuerySet.distinct in FakeQuerySet
FakeQuerySet
doesn't fully implement the API of Django's QuerySet
which can lead to confusing bugs (https://github.com/torchbox/wagtail/issues/1305)
There are a few other missing features such as values
and values_list
See https://docs.djangoproject.com/en/1.8/ref/models/querysets/ for a full list
Realistically FakeQuerySet will never implement the full QuerySet API - extra
and raw
can't be done without our own SQL parser, for example. As such, I'm editing this ticket to be specifically about the distinct
method, so that it covers an individual achievable piece of work... I would suggest opening additional tickets for any other specific methods that are needed.
Hi @gasman , I am looking to pick this up.
As of now, distinct can be called with and without a fields list. The call with the fields list is only supported for postgres backend, and raises an django.db.utils.NotSupportedError: DISTINCT ON fields is not supported by this database backend
error when used with an unsupported backend. Do we also mimic the same behavior for the FakeQuerySet's method?