def getSankaLists(kaisaibi): lst = [] for n in range(9): lst.append([]) for s in Comment.gql(' WHERE kaisaibi = :kaisaibi ORDER BY class_id, tourokudate_text ', kaisaibi = kaisaibi): #s.comment_text = define.split_text(s.comment_text, 20) s.bgcolor = ClassList.clscolor.get(s.chara_class.upper(), '') sanka = s.sanka if (sanka == u'参加'): if (s.chara_class.upper() in ClassList.flist): lst[0].append(s) elif (s.chara_class.upper() in ClassList.slist): lst[1].append(s) elif (s.chara_class.upper() in ClassList.plist): lst[2].append(s) elif (s.chara_class.upper() in ClassList.mlist): lst[3].append(s) elif (sanka == u'遅刻') or (sanka == u'補欠'): if (s.chara_class.upper() in ClassList.flist): lst[4].append(s) elif (s.chara_class.upper() in ClassList.slist): lst[5].append(s) elif (s.chara_class.upper() in ClassList.plist): lst[6].append(s) elif (s.chara_class.upper() in ClassList.mlist): lst[7].append(s) elif (sanka == u'お休み'): lst[8].append(s) return lst[0], lst[1], lst[2], lst[3], lst[4], lst[5], lst[6], lst[7], lst[8]
def post(self): b = 1 kyou = datetime.datetime.now(JST()).strftime('%Y-%m-%d') year = int(kyou[0:4]) month = int(kyou[5:7]) if((month - b) < 1): month = month + 12 - b year -= 1 else: month -= b sonohi = datetime.date(year, month, 1).strftime('%Y-%m-%d') for s in Comment.gql(' WHERE kaisaibi < :kaisaibi', kaisaibi = sonohi): s.delete() try: ymd = self.request.get('kaisaibi').split('-') theday = datetime.date(int(ymd[0]), int(ymd[1]), int(ymd[2])) except ValueError: theday = datetime.datetime.now(JST()) self.redirect('/insert?kaisaibi=' + theday.strftime('%Y-%m-%d'))