Esempio n. 1
0
def icollege_topic(request,template_name="public/icollege_topic.html"):
	u = request.session['user']
	total_count = get_i_college_topic_count(u.id)

	paginator = Paginator(total_count,20)

	page_number = request.GET.get('page')
	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)

	less_than_certain_size = paginator.check_less_than_certain_size()
	topics = get_i_college_limit_topics(u.id,start=page.start,end=page.end)
	data={'topics':topics,'topic_current':'ana_focus_current','total_count':total_count,'page':page,'pages':pages,'less_than_certain_size':less_than_certain_size}
	return render_to_response(template_name,data,context_instance=RequestContext(request))
Esempio n. 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))