Skip to content
This repository has been archived by the owner on Jun 29, 2020. It is now read-only.

Commit

Permalink
SQLミスってて新しい順に並ばなかったの修正した
Browse files Browse the repository at this point in the history
Remove LIMIT 10

Modify SQL
  • Loading branch information
giginet committed Dec 26, 2015
1 parent f3686a0 commit 6aa0869
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib/django-activities/activities/models.py
Expand Up @@ -25,8 +25,9 @@ def latests(self):
"""
qs = super().get_queryset()
qs = qs.raw(
'SELECT *, MAX(id) AS id FROM activities_activity GROUP BY '
'content_type_id, object_id ORDER BY id DESC'
'SELECT *, MAX(id) AS max_id FROM activities_activity GROUP BY '
'content_type_id, object_id HAVING id = max_id '
'ORDER BY id DESC'
)
qs.count = lambda: len(list(qs))
return qs
Expand Down

0 comments on commit 6aa0869

Please sign in to comment.