コード例 #1
0
 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))
コード例 #2
0
 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))
コード例 #3
0
def on_pre_delete(**kwargs):
    """ Update base user class's groups """
    instance = kwargs['instance']
    if instance.hackathon == Hackathon.objects.current():
        acl.remove_user_from_group(instance.user, acl.group_attendee)