Exemplo n.º 1
0
def compile_resumes():
    shutil.rmtree(RESUMES_BY_MAJOR_LOCATION)
    os.makedirs(RESUMES_BY_MAJOR_LOCATION)
    resource_guides = CorporateResourceGuide.objects.filter(active=True)
    if resource_guides:
        shutil.copy(
            PROJECT_PATH + resource_guides[0].resource_guide.url,
            os.path.sep.join([
                RESUMES_BY_MAJOR_LOCATION,
                slugify(resource_guides[0].name) + '.pdf'
            ]))
    for resume_major in Major.objects.all():
        query = Q(major=resume_major)
        users_in_major = get_members().filter(query)
        for user in users_in_major:
            if user.resume:
                major_dir = os.path.sep.join(
                    [RESUMES_BY_MAJOR_LOCATION,
                     slugify(resume_major.name)])
                if not os.path.exists(major_dir):
                    os.makedirs(major_dir)
                resume_name = slugify(user.last_name + '_' + user.first_name +
                                      '_' + user.uniqname) + '.pdf'
                shutil.copy(PROJECT_PATH + user.resume.url,
                            os.path.sep.join([major_dir, resume_name]))
    if os.path.exists(RESUMES_BY_YEAR_LOCATION):
        shutil.rmtree(RESUMES_BY_YEAR_LOCATION)
    os.makedirs(RESUMES_BY_YEAR_LOCATION)
    if resource_guides:
        shutil.copy(
            PROJECT_PATH + resource_guides[0].resource_guide.url,
            os.path.sep.join([
                RESUMES_BY_YEAR_LOCATION,
                slugify(resource_guides[0].name) + '.pdf'
            ]))
    not_alum = ~Q(name='Alumni')
    for standing in Standing.objects.all():
        members = get_members().filter(standing=standing)
        if standing.name == 'Alumni':
            status_dir = os.path.sep.join(
                [RESUMES_BY_YEAR_LOCATION,
                 slugify(standing.name)])
        else:
            status_dir = os.path.sep.join([
                RESUMES_BY_YEAR_LOCATION,
                slugify(standing.name) + '-student'
            ])
        if not os.path.exists(status_dir):
            os.makedirs(status_dir)
        for user in members:
            if user.resume:
                current_grad_year = user.expect_grad_date.year
                year_dir = os.path.sep.join(
                    [status_dir, 'Graduating' + slugify(current_grad_year)])
                if not os.path.exists(year_dir):
                    os.makedirs(year_dir)
                resume_name = slugify(user.last_name + '_' + user.first_name +
                                      '_' + user.uniqname) + '.pdf'
                shutil.copy(PROJECT_PATH + user.resume.url,
                            os.path.sep.join([year_dir, resume_name]))
Exemplo n.º 2
0
    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
Exemplo n.º 3
0
    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
Exemplo n.º 4
0
def compile_resumes():
    shutil.rmtree(RESUMES_BY_MAJOR_LOCATION)
    os.makedirs(RESUMES_BY_MAJOR_LOCATION)
    resource_guides = CorporateResourceGuide.objects.filter(active=True)
    if resource_guides:
        shutil.copy(PROJECT_PATH+resource_guides[0].resource_guide.url,os.path.sep.join([RESUMES_BY_MAJOR_LOCATION,slugify(resource_guides[0].name)+'.pdf']))
    for resume_major in Major.objects.all():
        query=Q(major=resume_major)
        users_in_major = get_members().filter(query)
        for user in users_in_major:
            if user.resume:
                major_dir = os.path.sep.join([RESUMES_BY_MAJOR_LOCATION,slugify(resume_major.name)])
                if not os.path.exists(major_dir):
                    os.makedirs(major_dir)
                resume_name=slugify(user.last_name+'_'+user.first_name+'_'+user.uniqname)+'.pdf'
                shutil.copy(PROJECT_PATH+user.resume.url,os.path.sep.join([major_dir,resume_name]))
    if os.path.exists(RESUMES_BY_YEAR_LOCATION):
        shutil.rmtree(RESUMES_BY_YEAR_LOCATION)
    os.makedirs(RESUMES_BY_YEAR_LOCATION)
    if resource_guides:
        shutil.copy(PROJECT_PATH+resource_guides[0].resource_guide.url,os.path.sep.join([RESUMES_BY_YEAR_LOCATION,slugify(resource_guides[0].name)+'.pdf']))
    not_alum = ~Q(name='Alumni')
    for standing in Standing.objects.all():
        members = get_members().filter(standing=standing)
        if standing.name == 'Alumni':
            status_dir = os.path.sep.join([RESUMES_BY_YEAR_LOCATION,slugify(standing.name)])
        else:
            status_dir = os.path.sep.join([RESUMES_BY_YEAR_LOCATION, slugify(standing.name)+'-student'])
        if not os.path.exists(status_dir):
            os.makedirs(status_dir)
        for user in members:
            if user.resume:
                current_grad_year = user.expect_grad_date.year
                year_dir = os.path.sep.join([status_dir,'Graduating'+slugify(current_grad_year)])
                if not os.path.exists(year_dir):
                    os.makedirs(year_dir)
                resume_name=slugify(user.last_name+'_'+user.first_name+'_'+user.uniqname)+'.pdf'
                shutil.copy(PROJECT_PATH+user.resume.url,os.path.sep.join([year_dir,resume_name]))
Exemplo n.º 5
0
class ManageProjectLeaderForm(Form):
    member = forms.ModelChoiceField(
        queryset=get_members().order_by('last_name'))
    is_project_leader = forms.BooleanField(required=False)