Ejemplo n.º 1
0
def getUnseenNotifs(request):
	jsonSerializer = JSONSerializer()
	unseenNotifs = get_list_or_404(Message, seen=False)
	return HttpResponse(jsonSerializer.serialize(unseenNotifs), 'application/json')
Ejemplo n.º 2
0
def getRecentNotifs(request, n=10):
	jsonSerializer = JSONSerializer()
	notifs = Message.objects.all()
	if len(notifs) >= 10: notifs = notifs[(len(notifs) - 10):]

	return HttpResponse(jsonSerializer.serialize(notifs), 'application/json')