def presentation(request, qoffset='0'): if request.user.username not in settings.STAFF_SUNETIDS: return redirect('/') qoffset = int(qoffset) if qoffset >= Question.objects.count(): return redirect('/') q = Question.objects.order_by('pk')[qoffset] return render_to_response('presentation.html', { 'result': feud.top_k_for_question(q) }, context_instance=RequestContext(request))
def handle(self, *args, **options): award_map = {} for r in Resident.objects.all(): award_map[ r.name ] = [] for q in Question.objects.filter(istwoans=False): result = feud.top_k_for_question(q, 1) if len(result['answers']): award_map[ result['answers'][0]['one'] ].append( str(result['answers'][0]['number']) + ' - ' + q.qtext ) pp = PrettyPrinter(indent=2) pp.pprint(award_map)