Parcourir la source

211201 contents sorted by date desc

yukyo0821 il y a 3 ans
Parent
commit
f6e1af9d17
1 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. 2 2
      models/contents/routes.py

+ 2 - 2
models/contents/routes.py

@@ -109,10 +109,10 @@ class Content(Resource):
 
     def get(self):
         if self.url:
-            return list(self._search_content())
+            sortedData = sorted(list(self._search_content()), key=lambda x:x['date'], reverse=True)
+            return sortedData
         else:
             sortedData = sorted(list(self._get_contents()), key=lambda x:x['date'], reverse=True)
-            #print()
             return sortedData
 
     def post(self):