def view_members(request): active_members = Member.objects.active_members().order_by( 'user__first_name') here_today = arp.users_for_day() has_key = has_mail = None if request.user.get_profile().is_manager(): has_key = Member.objects.members_with_keys() has_mail = Member.objects.members_with_mail() search_terms = None search_results = None if request.method == "POST": search_form = MemberSearchForm(request.POST) if search_form.is_valid(): search_terms = search_form.cleaned_data['terms'] search_results = Member.objects.search(search_terms, True) else: search_form = MemberSearchForm() return render_to_response('members/view_members.html', { 'active_members': active_members, 'here_today': here_today, 'search_results': search_results, 'search_form': search_form, 'search_terms': search_terms, 'has_key': has_key, 'has_mail': has_mail }, context_instance=RequestContext(request))
def ticker(request): here_today = arp.users_for_day() 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 view_members(request): active_members = Member.objects.active_members().order_by("user__first_name") here_today = arp.users_for_day() has_key = has_mail = None if request.user.get_profile().is_manager(): has_key = Member.objects.members_with_keys() has_mail = Member.objects.members_with_mail() search_terms = None search_results = None if request.method == "POST": search_form = MemberSearchForm(request.POST) if search_form.is_valid(): search_terms = search_form.cleaned_data["terms"] search_results = Member.objects.search(search_terms, True) else: search_form = MemberSearchForm() return render_to_response( "members/view_members.html", { "active_members": active_members, "here_today": here_today, "search_results": search_results, "search_form": search_form, "search_terms": search_terms, "has_key": has_key, "has_mail": has_mail, }, context_instance=RequestContext(request), )
def send_notifications(): here_today = arp.users_for_day() 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.users_for_day() 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 view_members(request): active_members = Member.objects.active_members().order_by('user__first_name') here_today = arp.users_for_day() has_key = has_mail = None if request.user.get_profile().is_manager(): has_key = Member.objects.members_with_keys() has_mail = Member.objects.members_with_mail() search_terms = None search_results = None if request.method == "POST": search_form = MemberSearchForm(request.POST) if search_form.is_valid(): search_terms = search_form.cleaned_data['terms'] search_results = Member.objects.search(search_terms, True) else: search_form = MemberSearchForm() return render_to_response('members/view_members.html', {'active_members': active_members, 'here_today': here_today, 'search_results': search_results, 'search_form': search_form, 'search_terms': search_terms, 'has_key': has_key, 'has_mail': has_mail}, context_instance=RequestContext(request))
def here_today(request): members = arp.users_for_day() return render_to_response('tablet/here_today.html', {'members': members}, context_instance=RequestContext(request))
def here_today(request): members = arp.users_for_day() return render_to_response('members/here_today.html',{ 'members':members }, context_instance=RequestContext(request))