def un_approve_application(self, request, queryset): total = 0 for obj in queryset: if obj.approved is True: acl.remove_user_from_group(obj.user, acl.group_hacker) acl.add_user_to_group(obj.user, acl.group_pending_hacker) obj.approved = False obj.save() total += 1 self.message_user(request, 'Un-approved {} hackers'.format(total))
def get_or_create(user: User, hackathon: Hackathon): """ Gets current attendee status for user/hackathon combo. If non exists one is created properly """ try: attendee_status = AttendeeStatus.objects.get(user=user, hackathon=hackathon) except ObjectDoesNotExist: attendee_status = AttendeeStatus.objects.create( user=user, hackathon=hackathon) acl.add_user_to_group(user, acl.group_attendee) return attendee_status
def approve_application(self, request, queryset): total = 0 for obj in queryset: if obj.approved is False: acl.add_user_to_group(obj.user, acl.group_hacker) acl.remove_user_from_group(obj.user, acl.group_pending_hacker) obj.approved = True obj.save() total += 1 email.send_template_to_user( obj.user, 'hacker_register_accepted', 'HackFSU Hacker Registration Approved' ) self.message_user(request, 'Approved & emailed {} pending hackers'.format(total))
def work(self, request, req, res): # Ensure is attendee current_hackathon = Hackathon.objects.current() attendee_status = AttendeeStatus.objects.get_or_create( user=request.user, hackathon=current_hackathon) JudgeInfo.objects.create(hackathon=current_hackathon, user=request.user, attendee_status=attendee_status, affiliation=req['affiliation'], organizer_contact=req['organizer_contact']) acl.add_user_to_group(request.user, acl.group_pending_judge) # Send email for confirmation email.send_template(to_email=request.user.email, to_first_name=request.user.first_name, to_last_name=request.user.last_name, subject='Judge Registration Submitted!', template_name='judge_register_waiting')
def work(self, request, req, res): # Ensure is attendee current_hackathon = Hackathon.objects.current() attendee_status = AttendeeStatus.objects.get_or_create( user=request.user, hackathon=current_hackathon) MentorInfo.objects.create(hackathon=current_hackathon, user=request.user, attendee_status=attendee_status, affiliation=req['affiliation'], skills=req['skills'], motivation=req['motivation'], availability=req['availability']) acl.add_user_to_group(request.user, acl.group_pending_mentor) # Send email for confirmation email.send_template(to_email=request.user.email, to_first_name=request.user.first_name, to_last_name=request.user.last_name, subject='Mentor Registration Submitted!', template_name='mentor_register_waiting')