app/soc/logic/models/club.py
changeset 801 06a84103ed8b
parent 782 27924b0f13cd
child 804 13fcbd8598a4
equal deleted inserted replaced
800:738f6335b0e2 801:06a84103ed8b
    16 
    16 
    17 """Club (Model) query functions.
    17 """Club (Model) query functions.
    18 """
    18 """
    19 
    19 
    20 __authors__ = [
    20 __authors__ = [
    21   '"Lennard de Rijk" <ljvderijk@gmail.com>',
    21     '"Sverre Rabbelier" <sverre@rabbelier.nl>',
       
    22     '"Lennard de Rijk" <ljvderijk@gmail.com>',
    22   ]
    23   ]
    23 
    24 
    24 
    25 
    25 from soc.logic.models import group
    26 from soc.logic.models import group
       
    27 from soc.logic.models import group_app as group_app_logic
       
    28 from soc.logic.models import request as request_logic
    26 
    29 
    27 import soc.models.club
    30 import soc.models.club
    28 import soc.models.group
    31 import soc.models.group
    29 
    32 
    30 
    33 
    38     """
    41     """
    39 
    42 
    40     super(Logic, self).__init__(model, base_model=base_model,
    43     super(Logic, self).__init__(model, base_model=base_model,
    41                                 scope_logic=scope_logic)
    44                                 scope_logic=scope_logic)
    42 
    45 
       
    46   def _onCreate(self, entity):
       
    47     """Invites the org admin and backup admin
       
    48     """
       
    49 
       
    50     # Find their application
       
    51     application = group_app_logic.logic.getFromFields(link_id=entity.link_id)
       
    52 
       
    53     properties = {
       
    54         'scope': entity,
       
    55         'scope_path': entity.key().name(),
       
    56         'role': 'club_admin',
       
    57         'group_accepted': True,
       
    58         }
       
    59 
       
    60     for admin in [application.applicant, application.backup_admin]:
       
    61       properties['link_id'] = admin.link_id
       
    62       key_fields = request_logic.logic.getKeyFieldsFromDict(properties)
       
    63       request_logic.logic.updateOrCreateFromFields(properties, key_fields)
       
    64 
    43 
    65 
    44 logic = Logic()
    66 logic = Logic()