def bdays_month(month):
if month not in range(1, 13):
abort(400, 'Not a valid month')
# SO questions/36155332
_, num_days = calendar.monthrange(THIS_YEAR, month)
start = date(THIS_YEAR, month, 1)
end = date(THIS_YEAR, month, num_days)
now = _get_current_date()
# TODO: some duplication here with index()
bdays = (Birthday.query.filter(Birthday.bday <= end)
.filter(Birthday.bday >= start))
month_name = calendar.month_name[month][:3]
return render_template("index.html",
data=bdays,
now=now,
active_tab=month_name,
tabs=TABS)
评论列表
文章目录