def publishList(request): publishs = Publish.all().order('-publish_date') template_values = {'publishs': publishs, 'userName': users.get_current_user().nickname().split('@')[0], 'logout': users.create_logout_url('/')} return render_to_response('admin/publish/publish.html', template_values)
def mainPage(request): publishs = Publish.all().order('-publish_date') template_values = {'publishs': publishs} if users.get_current_user(): template_values['userName'] = users.get_current_user().nickname().split('@')[0] template_values['logout'] = users.create_logout_url('/') return render_to_response('index.html', template_values)
def insert_Publish(request): publish = Publish.gql('ORDER BY id DESC').get() max = (publish.id + 1) if publish else 0 bulletin = Publish() bulletin.title = request.POST['title'] bulletin.content = request.POST['content'] bulletin.type = request.POST['type'] bulletin.id = max + 1 # bulletin.publish_date = datetime.datetime.now(TaiwanTimeZone()) bulletin.put() return redirect('/admin/publish')