示例#1
0
def icollege_ask(request,template_name="public/icollege_ask.html"):
	u = request.session['user']
	page_number = request.GET.get('page')
	paginator = Paginator(get_i_college_question_count(u.id),20)

	if page_number and page_number.isdigit():
		try:
			page = paginator.page(int(page_number))
			pages = paginator.calculate_display_pages(int(page_number))
		except EmptyPage:
			page = paginator.page(1)
			pages = paginator.calculate_display_pages(1)
	else:
		page = paginator.page(1)
		pages = paginator.calculate_display_pages(1)
	
	questions = get_i_college_limit_questions(u.id,start=page.start,end=page.end)
	subjects = get_subjects()
	data={'questions':questions,'ask_current':'ana_focus_current','subjects':subjects,'page':page}
	return render_to_response(template_name,data,context_instance=RequestContext(request))
示例#2
0
def icollege(request,template_name="public/icollege3.html"):
	u = request.session['user']
	# page_number = request.GET.get('page')
	# paginator = Paginator(get_i_college_article_count(u.id),5)

	# if page_number and page_number.isdigit():
	# 	try:
	# 		page = paginator.page(int(page_number))
	# 		pages = paginator.calculate_display_pages(int(page_number))
	# 	except EmptyPage:
	# 		page = paginator.page(1)
	# 		pages = paginator.calculate_display_pages(1)
	# else:
	# 	page = paginator.page(1)
	# 	pages = paginator.calculate_display_pages(1)
	
	articles = get_articles_by_i_college(u.id,0,5)
	topics = get_i_college_limit_topics(u.id,0,5)
	questions = get_i_college_limit_questions(u.id,0,20)
	subjects = get_subjects()
	data={'articles':articles,'topics':topics,'questions':questions,'all_current':'ana_focus_current','subjects':subjects}
	return render_to_response(template_name,data,context_instance=RequestContext(request))