OSDN Git Service

dict sort
authoryamat0jp <yamat0jp@yahoo.co.jp>
Fri, 18 Nov 2016 09:32:41 +0000 (18:32 +0900)
committeryamat0jp <yamat0jp@yahoo.co.jp>
Fri, 18 Nov 2016 09:32:41 +0000 (18:32 +0900)
__pycache__/index.cpython-35.pyc
index.py
static/db/db.json

index c1ad6cb..b8dd503 100644 (file)
Binary files a/__pycache__/index.cpython-35.pyc and b/__pycache__/index.cpython-35.pyc differ
index efc1df5..b2f5eac 100755 (executable)
--- a/index.py
+++ b/index.py
@@ -37,7 +37,7 @@ class IndexHandler(BaseHandler):
             start = len(table)-i
             if start < 0:
                 start = 0
-        rec = table.all()[start:start+i]
+        rec = sorted(table.all(),key=lambda x: x['number'])[start:start+i]
         if len(table) >= 10*i:
             self.render('modules/full.htm',position=pos,records=rec,data=params,db=dbname)  
         self.render('modules/index.htm',position=pos,records=rec,data=params,username=na,db=dbname)
index 2fe0700..1bc3396 100644 (file)
@@ -1 +1 @@
-{"bbs3": {}, "bbs2": {}, "bbs": {"1": {"comment": "<p>testing now", "number": 1, "name": "\u7ba1\u7406\u8005", "password": "", "date": "2016/11/17/16:37", "title": "\u30c6\u30b9\u30c8"}, "2": {"comment": "<p>\uff12\u4ef6\u76ee\u306e\u8a18\u4e8b\u3067\u3057\u3087\u3046\u304b", "number": 2, "name": "master", "password": "", "date": "2016/11/17/16:38", "title": "\u30c6\u30b9\u30c8"}, "3": {"comment": "<p>\u3053\u306e\u63b2\u793a\u677f\u306f\u3059\u3054\u3044\u3067\u3059\u304c\u307e\u3060\u30ed\u30fc\u30ab\u30eb\u74b0\u5883\u3067\u3057\u304b\u30c6\u30b9\u30c8\u306b\u6210\u529f\u3057\u3066\u3044\u307e\u305b\u3093\r\n<p>\u305d\u308c\u304c\u6b8b\u5ff5\u306a\u3068\u3053\u308d\u3067\u3059", "number": 3, "name": "master", "password": "", "date": "2016/11/18/16:05", "title": "\u30bf\u30a4\u30c8\u30eb\u306a\u3057."}}, "_default": {"5": {"title2": "pybbs", "mentenance": false, "count": 30, "password": "admin", "title": "pybbs", "kinds": "conf"}}, "bbs1": {}}
\ No newline at end of file
+{"bbs1": {}, "_default": {"5": {"kinds": "conf", "title": "pybbs", "count": 30, "mentenance": false, "password": "admin", "title2": "pybbs"}}, "bbs3": {}, "bbs2": {}, "bbs": {"1": {"date": "2016/11/17/16:37", "number": 1, "title": "\u30c6\u30b9\u30c8", "password": "", "name": "\u7ba1\u7406\u8005", "comment": "<p>testing now"}, "2": {"date": "2016/11/17/16:38", "number": 2, "title": "\u30c6\u30b9\u30c8", "password": "", "name": "master", "comment": "<p>\uff12\u4ef6\u76ee\u306e\u8a18\u4e8b\u3067\u3057\u3087\u3046\u304b"}, "3": {"date": "2016/11/18/16:05", "number": 3, "title": "\u30bf\u30a4\u30c8\u30eb\u306a\u3057.", "password": "", "name": "master", "comment": "<p>\u3053\u306e\u63b2\u793a\u677f\u306f\u3059\u3054\u3044\u3067\u3059\u304c\u307e\u3060\u30ed\u30fc\u30ab\u30eb\u74b0\u5883\u3067\u3057\u304b\u30c6\u30b9\u30c8\u306b\u6210\u529f\u3057\u3066\u3044\u307e\u305b\u3093\r\n<p>\u305d\u308c\u304c\u6b8b\u5ff5\u306a\u3068\u3053\u308d\u3067\u3059"}, "4": {"date": "2016/11/18/16:31", "number": 4, "title": "\u30bf\u30a4\u30c8\u30eb\u306a\u3057.", "password": "", "comment": "<p>\u30c6\u30b9\u30c8\u3057\u307e\u3059", "name": "master"}}}
\ No newline at end of file