def admin_index(request): photos = GramPhoto.query().order(-GramPhoto.add_time) url = blobstore.create_upload_url(url_for('gram/admin/add')) return render_to_response( 'gram/admin/index.html', { 'photos': photos, 'url': url })
def load(request, offset): offset = int(offset) if offset <= 0: return render_to_response('empty.html') grams = GramPhoto.query().order(-GramPhoto.add_time) length = grams.count() if offset >= length: return render_to_response('empty.html') limit = 8 is_end = False if offset + limit >= length: limit = length - offset is_end = True grams = grams.fetch(limit, offset=offset-1) return render_to_response('gram/load.html', {'grams': grams, 'is_end': is_end})
def index(request): grams = GramPhoto.query().order(-GramPhoto.add_time).fetch(4) return render_to_response('page/index.html', {'grams': grams})