コード例 #1
0
ファイル: utility.py プロジェクト: kylelady/mig-website
    def profiles_you_can_view(cls, user):
        if user.is_superuser:
            return get_members()
        current_positions = cls.get_current_officer_positions(user)
        query_all = Q(position__name="President") | Q(position__name="Vice President")
        query_actives = Q(position__name="Membership Officer")
        query_electees = Q(position__name="Graduate Student Coordinator")
        query_electee_groups = Q(leaders=user.userprofile.memberprofile) | Q(officers=user.userprofile.memberprofile)
        query_out = MemberProfile.objects.none()
        if current_positions:
            if current_positions.filter(query_all).exists():
                return get_members()
            if current_positions.filter(query_actives).exists():
                query_out = query_out | get_actives()
            if current_positions.filter(query_electees).exists():
                query_out = query_out | get_electees()

        electee_groups_led = ElecteeGroup.objects.filter(query_electee_groups)
        for electee_group in electee_groups_led:
            query_out = query_out | electee_group.members.all()

        return query_out
コード例 #2
0
ファイル: utility.py プロジェクト: kylelady/mig-website
    def profiles_you_can_view(cls,user):
        if user.is_superuser:
            return get_members()
        current_positions = cls.get_current_officer_positions(user) 
        query_all = Q(position__name='President')|Q(position__name='Vice President')
        query_actives = Q(position__name='Membership Officer')
        query_electees= Q(position__name='Graduate Student Coordinator')
        query_electee_groups = Q(leaders=user.userprofile.memberprofile)|Q(officers=user.userprofile.memberprofile)
        query_out = MemberProfile.objects.none()
        if current_positions:
            if current_positions.filter(query_all).exists():
                return get_members()
            if current_positions.filter(query_actives).exists():
                query_out = query_out | get_actives()
            if current_positions.filter(query_electees).exists():
                query_out = query_out | get_electees()
        
        electee_groups_led = ElecteeGroup.objects.filter(query_electee_groups)
        for electee_group in electee_groups_led:
            query_out = query_out|electee_group.members.all()

        return query_out
コード例 #3
0
ファイル: forms.py プロジェクト: kylelady/mig-website
def get_unassigned_electees():
    current_electee_groups = ElecteeGroup.objects.filter(term=get_current_term())
    current_electees = get_electees()
    for group in current_electee_groups.all():
        current_electees=current_electees.exclude(pk__in=group.members.all())
    return current_electees.order_by('standing','last_name')