praekelt / jmbo-foundry

Jmbo generic behaviour/templates app.
http://www.jmbo.org
Other
1 stars 3 forks source link

Eliminate duplicates in listing queryset #69

Open hedleyroos opened 9 years ago

hedleyroos commented 9 years ago

If an object has the same category appear in "primary category" as well as "categories" then it appears twice in a listing.

jbeyers commented 8 years ago

Ack, just ran into that on UCM. Probable fix:

models.py, line 368:

- q = q.filter(q1|q2) + q = q.filter(q1|q2).distinct()

qoda commented 8 years ago

Be careful to use only() with distinct() as Oracle will fall over if not.

q = q.filter(q1|q2).only("id").distinct()
qoda commented 8 years ago

PR submitted to resolve this: https://github.com/praekelt/jmbo-foundry/pull/70

hedleyroos commented 8 years ago

I changed https://github.com/praekelt/jmbo-foundry/pull/70 a bit so we don't incur any performance penalties. Fix deployed to develop.