-
Notifications
You must be signed in to change notification settings - Fork 0
/
views.py
36 lines (29 loc) · 992 Bytes
/
views.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from google.appengine.api import users
from google.appengine.ext import db
from common import redirect, respond
from models import Group, Fee, UserAlias
def home(request):
fees = get_fees()
params = { 'fees': fees, }
return respond('home.html', params)
def page_redirect(request, url):
params = {}
for code in ('login', 'power', 'param', 'missing'):
if request.GET.has_key(code):
params.update({"code_%s" % code: True,})
params.update({'url': "/%s" % url,})
return respond('redirect.html', params)
def page_not_found(request):
return respond('404.html')
def get_fees(group_id=None):
"""
please notice, there's a different function in helpers.py
with the same name.
"""
fee_query = db.Query(Fee)
if group_id:
group = Group.get_by_id(group_id)
fee_query.filter("group =", group)
fee_query.order('-date')
fees = fee_query.fetch(20)
return fees