def backgrounds(request): backgrounds = db.Query(Background) page = request.GET.get('page', 1) p = GAEPaginator(backgrounds, 20) try: results = p.page(page) except (EmptyPage, InvalidPage): results = p.page(p.num_pages) context = { 'title': 'Fanmento Administration - Backgrounds', 'name': request.user.email, 'page': results, 'active': 'backgrounds', } context.update(csrf(request)) return render_to_response('background_list.html', context)
def users(request): order = request.GET.get('sort', 'name') users = db.Query(User).order(order) page = request.GET.get('page', 1) p = GAEPaginator(users, 20) try: results = p.page(page) except (EmptyPage, InvalidPage): results = p.page(p.num_pages) context = { 'title': 'Fanmento Administration - Users', 'name': request.user.email, 'page': results, 'sort': order, 'active': 'users', } context.update(csrf(request)) return render_to_response('users_list.html', context)