Skip to content
Snippets Groups Projects
Commit fe0a3ff7 authored by Robert J. Newmark's avatar Robert J. Newmark
Browse files

Merge branch 'master' of git.autistici.org:djrandom

parents 43bff6ef 4ded54e8
No related branches found
No related tags found
No related merge requests found
...@@ -161,7 +161,7 @@ def most_played_json(): ...@@ -161,7 +161,7 @@ def most_played_json():
@require_auth @require_auth
def last_uploaded_json(): def last_uploaded_json():
n = int(request.args.get('n', 20)) n = int(request.args.get('n', 20))
last_uploaded = [x.to_dict() for x in MP3.last_uploaded(n)] last_uploaded = [x.sha1 for x in MP3.last_uploaded(n)]
return jsonify(results=last_uploaded) return jsonify(results=last_uploaded)
......
...@@ -39,7 +39,8 @@ class MP3(Base): ...@@ -39,7 +39,8 @@ class MP3(Base):
@classmethod @classmethod
def last_uploaded(cls, n=10): def last_uploaded(cls, n=10):
"""Return the N last uploaded songs.""" """Return the N last uploaded songs."""
return cls.query.filter_by(ready=True).order_by('desc uploaded_at').limit(n) return cls.query.filter_by(ready=True).order_by(
desc(cls.uploaded_at)).limit(n)
class PlayLog(Base): class PlayLog(Base):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment