Beispiel #1
0
def index(request):
    showcases = Showcase.all().filter('is_display =', True).order("-add_time")
    paginator = Paginator(showcases, 5)
    try:
        page = int(request.args.get('page', 1))
    except ValueError:
        page = 1
    try:
        showcases = paginator.page(page)
    except (EmptyPage, InvalidPage):
        showcases = paginator.page(paginator.num_pages())

    return render_to_response('showcase/index.html', {
        'showcases': showcases
    })
Beispiel #2
0
def admin_list(request):
    showcases = Showcase.all().order('-add_time')
    return render_to_response('showcase/admin/list.html', {'showcases':showcases})
Beispiel #3
0
def showcases(request):
  showcases_objs = Showcase.all()
  return render_json_response([to_dict(o) for o in showcases_objs])