def members(request, group=None): if not group: first_package = MembershipPackage.objects.filter(enabled=True).order_by('name').first() if first_package: group = first_package.name users = MemberGroups.get_members(group) if users: member_count = users.count() group_name = MemberGroups.GROUP_DICT[group] else: group_name = "%s Members" % group member_count = 0 # See if our 'group' is a package name package = MembershipPackage.objects.filter(name=group).first() if package: users = User.helper.members_by_package(package.name).order_by('first_name') member_count = len(users) # How many members do we have? total_members = User.helper.active_members().count() group_list = MemberGroups.get_member_groups() context = { 'group': group, 'group_name': group_name, 'users': users, 'member_count': member_count, 'group_list': group_list, 'total_members': total_members } return render(request, 'staff/members/members.html', context)
def members(request, group=None): if not group: first_plan = MembershipPlan.objects.all().order_by('name').first() if first_plan: group = first_plan.name users = MemberGroups.get_members(group) if users: member_count = users.count() group_name = MemberGroups.GROUP_DICT[group] else: # Assume the group is a membership plan users = User.helper.members_by_plan(group) member_count = len(users) group_name = "%s Members" % group # How many members do we have? total_members = User.helper.active_members().count() group_list = MemberGroups.get_member_groups() context = { 'group': group, 'group_name': group_name, 'users': users, 'member_count': member_count, 'group_list': group_list, 'total_members': total_members } return render(request, 'staff/user/members.html', context)
def bcc_tool(request, group=None): if not group: group = MemberGroups.ALL group_name = "All Members" users = User.helper.active_members() elif group in MemberGroups.GROUP_DICT: group_name = MemberGroups.GROUP_DICT[group] users = MemberGroups.get_members(group) else: group_name = "%s Members" % group users = User.helper.members_by_package(group) group_list = MemberGroups.get_member_groups() context = {'group': group, 'group_name': group_name, 'group_list': group_list, 'users': users} return render(request, 'staff/members/bcc_tool.html', context)