def ticker(request): here_today = arp.here_today() now = timezone.localtime(timezone.now()) midnight = now - timedelta(seconds=now.hour * 60 * 60 + now.minute * 60 + now.second) device_logs = ArpLog.objects.for_range(midnight, now) counts = {} counts['members'] = Member.objects.active_members().count() counts['full_time'] = Membership.objects.by_date(now).filter( has_desk=True).count() counts['part_time'] = counts['members'] - counts['full_time'] counts['here_today'] = len(here_today) counts['devices'] = len(device_logs) # Auto refresh? refresh = True if request.GET.has_key("norefresh"): refresh = False return render_to_response('members/ticker.html', { 'counts': counts, 'members': here_today, 'refresh': refresh }, context_instance=RequestContext(request))
def send_notifications(): here_today = arp.here_today() for n in UserNotification.objects.filter(sent_date__isnull=True): if n.notify_user.get_profile() in here_today: if n.target_user.get_profile() in here_today: email.send_user_notifications(n.notify_user, n.target_user) n.sent_date = timezone.localtime(timezone.now()) n.save()
def send_notifications(): here_today = arp.here_today() for n in UserNotification.objects.filter(sent_date__isnull=True): if n.notify_user.get_profile() in here_today: if n.target_user.get_profile() in here_today: email.send_user_notifications(n.notify_user, n.target_user) n.sent_date=timezone.localtime(timezone.now()) n.save()
def ticker(request): here_today = arp.here_today() now = datetime.now() midnight = now - timedelta(seconds=now.hour*60*60 + now.minute*60 + now.second) device_logs = ArpLog.objects.for_range(midnight, now) counts = {} counts['members'] = Member.objects.active_members().count() counts['full_time'] = Membership.objects.by_date(now).filter(has_desk=True).count() counts['part_time'] = counts['members'] - counts['full_time'] counts['here_today'] = len(here_today) counts['devices'] = len(device_logs) # Auto refresh? refresh = True; if request.GET.has_key("norefresh"): refresh = False; return render_to_response('members/ticker.html',{'counts':counts, 'members':here_today, 'refresh':refresh}, context_instance=RequestContext(request))
def here_today(request): members = arp.here_today() return render_to_response('members/here_today.html',{ 'members':members }, context_instance=RequestContext(request))
def here_today(request): members = arp.here_today() return render_to_response("tablet/here_today.html", {"members": members}, context_instance=RequestContext(request))
def here_today(request): members = arp.here_today() return render_to_response('tablet/here_today.html', {'members': members}, context_instance=RequestContext(request))