def delete(request, key): user = users.get_current_user() type = request.GET.get('type') if type == 'comment': try: model = Comment.get(key) except Exception, e: raise Http404
def list(request, jots): try: page = int(request.GET['page']) except: page = 1 paginator = utils.createPaginator(page=page) for jot in jots: if jot.tags and jot.tags[0] != 'photo': jot.what = utils.strip_tags(jot.what)[:200] + "..." recent_posts = Jot.all().order('-when').fetch(RECENT_POST_SIZE, 0) recent_comments = Comment.all().order('-when').fetch(RECENT_POST_SIZE, 0) read_most = Jot.all().order('-read_num').fetch(RECENT_POST_SIZE, 0) return render_to_response('index.html', {'jots':jots, 'paginator':paginator, 'recent_posts':recent_posts, 'recent_comments':recent_comments, 'read_most':read_most}, context_instance=RequestContext(request))
def news(request): recent_posts = Jot.all().order('-when').fetch(RECENT_POST_SIZE, 0) recent_comments = Comment.all().order('-when').fetch(RECENT_POST_SIZE, 0) read_most = Jot.all().order('-read_num').fetch(RECENT_POST_SIZE, 0) return render_to_response('news.html', {'recent_posts':recent_posts, 'recent_comments':recent_comments, 'read_most':read_most}, context_instance=RequestContext(request))
return HttpResponseRedirect('/') model.remove() return HttpResponseRedirect('/') @login_required def comment(request, key): what = request.POST.get('what', None) #google user user = users.get_current_user() #django user user = User.all().filter('user = '******'/view/' + key + '/') def view(request, key): try: page = int(request.GET['page']) except: page = 1 paginator = utils.createPaginator(page) try: jot = Jot.get(key) jot.read_num += 1 jot.put() except Exception, e: