app/soc/views/models/group.py
changeset 1640 c63fb0240203
parent 1430 ff8cc6b15e6a
child 1667 95bc81b4cd5c
equal deleted inserted replaced
1639:170ac4ca078d 1640:c63fb0240203
    21     '"Sverre Rabbelier" <sverre@rabbelier.nl>',
    21     '"Sverre Rabbelier" <sverre@rabbelier.nl>',
    22     '"Lennard de Rijk" <ljvderijk@gmail.com>',
    22     '"Lennard de Rijk" <ljvderijk@gmail.com>',
    23   ]
    23   ]
    24 
    24 
    25 
    25 
    26 from google.appengine.api import users
       
    27 
       
    28 from django import forms
    26 from django import forms
    29 from django import http
    27 from django import http
    30 from django.utils.translation import ugettext
    28 from django.utils.translation import ugettext
    31 
    29 
    32 from soc.logic import dicts
    30 from soc.logic import dicts
    56       params: a dict with params for this View
    54       params: a dict with params for this View
    57     """
    55     """
    58 
    56 
    59     new_params = {}
    57     new_params = {}
    60 
    58 
    61     new_params['extra_dynaexclude'] = ['founder','home', 'tos',
    59     new_params['extra_dynaexclude'] = ['founder', 'home', 'tos',
    62                                        'member_template', 'status']
    60                                        'member_template', 'status']
    63     new_params['edit_extra_dynaproperties'] = {
    61     new_params['edit_extra_dynaproperties'] = {
    64         'founded_by': forms.CharField(widget=widgets.ReadOnlyInput(),
    62         'founded_by': forms.CharField(widget=widgets.ReadOnlyInput(),
    65                                    required=False),
    63                                    required=False),
    66         }
    64         }
   195 
   193 
   196     if not key_name:
   194     if not key_name:
   197       key_name = self._logic.getKeyNameFromFields(fields)
   195       key_name = self._logic.getKeyNameFromFields(fields)
   198 
   196 
   199     # create the group entity
   197     # create the group entity
   200     entity = self._logic.updateOrCreateFromKeyName(fields, key_name)
   198     self._logic.updateOrCreateFromKeyName(fields, key_name)
   201 
   199 
   202     # redirect to notifications list to see the admin invite
   200     # redirect to notifications list to see the admin invite
   203     return http.HttpResponseRedirect('/notification/list')
   201     return http.HttpResponseRedirect('/notification/list')
   204 
   202 
   205   def _applicantPost(self, request, context, fields):
   203   def _applicantPost(self, request, context, fields):
   241       params: a dict with params for this View
   239       params: a dict with params for this View
   242       kwargs: the Key Fields for the specified entity
   240       kwargs: the Key Fields for the specified entity
   243     """
   241     """
   244 
   242 
   245     # set the pagename to include the link_id
   243     # set the pagename to include the link_id
   246     page_name = '%s %s' %(page_name, kwargs['link_id'])
   244     page_name = '%s %s' % (page_name, kwargs['link_id'])
   247 
   245 
   248     # get the group from the request
   246     # get the group from the request
   249     group_logic = params['logic']
   247     group_logic = params['logic']
   250 
   248 
   251     group_entity = group_logic.getFromKeyFields(kwargs)
   249     group_entity = group_logic.getFromKeyFields(kwargs)
   324       params: a dict with params for this View
   322       params: a dict with params for this View
   325       kwargs: the Key Fields for the specified entity
   323       kwargs: the Key Fields for the specified entity
   326     """
   324     """
   327 
   325 
   328     # set the pagename to include the link_id
   326     # set the pagename to include the link_id
   329     page_name = '%s %s' %(page_name, kwargs['link_id'])
   327     page_name = '%s %s' % (page_name, kwargs['link_id'])
   330 
   328 
   331     # get the group from the request
   329     # get the group from the request
   332     group_logic = params['logic']
   330     group_logic = params['logic']
   333 
   331 
   334     group_entity = group_logic.getFromKeyFields(kwargs)
   332     group_entity = group_logic.getFromKeyFields(kwargs)
   384     Args:
   382     Args:
   385       params: a dict with params for this View.
   383       params: a dict with params for this View.
   386     """
   384     """
   387 
   385 
   388     params = dicts.merge(params, self._params)
   386     params = dicts.merge(params, self._params)
   389     logic = params['logic']
       
   390 
   387 
   391     # set fields to match every active role this user has
   388     # set fields to match every active role this user has
   392     fields = {'user': user,
   389     fields = {'user': user,
   393               'status': 'active'}
   390               'status': 'active'}
   394 
   391