Ejemplo n.º 1
0
def item(request, nr_item):
	try:
		voteuser = get_object_or_404(UserProfile, user=request.user)
	except:
		voteuser = UserProfile()
		voteuser.up_voted = []
		voteuser.down_voted = []
		item = get_object_or_404(ItemAgenda, pk=nr_item)
		return render_to_response("item.html", {'item':item, 'voteuser':voteuser},
			context_instance=RequestContext(request))
	item = get_object_or_404(ItemAgenda, pk=nr_item)
	return render_to_response("item.html", {'item':item, 'voteuser':voteuser},
		context_instance=RequestContext(request))
Ejemplo n.º 2
0
def lista(request):
	now = datetime.datetime.now()
	try:
		voteuser = get_object_or_404(UserProfile, user=request.user)
	except:
		voteuser = UserProfile()
		voteuser.up_voted = []
		voteuser.down_voted = []
		lista_itens = ItemAgenda.objects.filter()[:10]
		return render_to_response("lista.html", {'lista_itens':lista_itens, 'voteuser':voteuser, 'current_date': now},
			context_instance=RequestContext(request))
	lista_itens = ItemAgenda.objects.filter()[:10]
	return render_to_response("lista.html", {'lista_itens':lista_itens, 'voteuser':voteuser, 'current_date': now},
		context_instance=RequestContext(request))