app/soc/views/models/role.py
changeset 1152 b82caf7bb17c
parent 1129 a98a165c1300
child 1175 b39345efab20
equal deleted inserted replaced
1151:3116b927f4b9 1152:b82caf7bb17c
   113         'soc.views.models.%(module_name)s.manage',
   113         'soc.views.models.%(module_name)s.manage',
   114         'Manage a %(name)s'),]
   114         'Manage a %(name)s'),]
   115 
   115 
   116     new_params['extra_django_patterns'] = patterns
   116     new_params['extra_django_patterns'] = patterns
   117     new_params['scope_redirect'] = redirects.getInviteRedirect
   117     new_params['scope_redirect'] = redirects.getInviteRedirect
       
   118     new_params['create_template'] = 'soc/role/edit.html'
       
   119     new_params['edit_template'] = 'soc/role/edit.html'
   118 
   120 
   119     new_params['create_extra_dynafields'] = {
   121     new_params['create_extra_dynafields'] = {
   120        'clean_link_id' : cleaning.clean_existing_user('link_id'),
   122        'latitude':forms.fields.FloatField(widget=forms.HiddenInput),
   121        'clean_home_page' : cleaning.clean_url('home_page'),
   123        'longitude': forms.fields.FloatField(widget=forms.HiddenInput),
   122        'clean_blog' : cleaning.clean_url('blog'),
   124        'clean_link_id': cleaning.clean_existing_user('link_id'),
   123        'clean_photo_url' : cleaning.clean_url('photo_url'),
   125        'clean_home_page': cleaning.clean_url('home_page'),
       
   126        'clean_blog': cleaning.clean_url('blog'),
       
   127        'clean_photo_url': cleaning.clean_url('photo_url'),
   124        'scope_path': forms.CharField(widget=forms.HiddenInput,
   128        'scope_path': forms.CharField(widget=forms.HiddenInput,
   125                                   required=True),
   129                                   required=True),
   126        }
   130        }
   127 
   131 
   128     new_params['extra_dynaexclude'] = ['user', 'status', 'agreed_to_tos_on']
   132     new_params['extra_dynaexclude'] = ['user', 'status', 'agreed_to_tos_on']
   135     params['manage_template'] = 'soc/%(module_name)s/manage.html' % params
   139     params['manage_template'] = 'soc/%(module_name)s/manage.html' % params
   136 
   140 
   137   @decorators.merge_params
   141   @decorators.merge_params
   138   @decorators.check_access
   142   @decorators.check_access
   139   def invite(self, request, access_type,
   143   def invite(self, request, access_type,
   140                    page_name=None, params=None, **kwargs):
   144              page_name=None, params=None, **kwargs):
   141     """Creates the page on which an invite can be send out.
   145     """Creates the page on which an invite can be send out.
   142 
   146 
   143     Args:
   147     Args:
   144       request: the standard Django HTTP request object
   148       request: the standard Django HTTP request object
   145       access_type : the name of the access type which should be checked
   149       access_type : the name of the access type which should be checked
   367 
   371 
   368 
   372 
   369   @decorators.merge_params
   373   @decorators.merge_params
   370   @decorators.check_access
   374   @decorators.check_access
   371   def manage(self, request, access_type,
   375   def manage(self, request, access_type,
   372                    page_name=None, params=None, **kwargs):
   376              page_name=None, params=None, **kwargs):
   373     """Handles the request concerning the view that let's 
   377     """Handles the request concerning the view that let's 
   374        you manage a role's status.
   378        you manage a role's status.
   375 
   379 
   376     Args:
   380     Args:
   377       request: the standard Django HTTP request object
   381       request: the standard Django HTTP request object
   420 
   424 
   421 
   425 
   422   @decorators.merge_params
   426   @decorators.merge_params
   423   @decorators.check_access
   427   @decorators.check_access
   424   def request(self, request, access_type,
   428   def request(self, request, access_type,
   425                    page_name=None, params=None, **kwargs):
   429               page_name=None, params=None, **kwargs):
   426     """Handles the request concerning the view that creates a request
   430     """Handles the request concerning the view that creates a request
   427     for attaining a certain Role.
   431     for attaining a certain Role.
   428 
   432 
   429     Args:
   433     Args:
   430       request: the standard Django HTTP request object
   434       request: the standard Django HTTP request object
   526 
   530 
   527 
   531 
   528   @decorators.merge_params
   532   @decorators.merge_params
   529   @decorators.check_access
   533   @decorators.check_access
   530   def processRequest(self, request, access_type,
   534   def processRequest(self, request, access_type,
   531                    page_name=None, params=None, **kwargs):
   535                      page_name=None, params=None, **kwargs):
   532     """Creates the page upon which a request can be processed.
   536     """Creates the page upon which a request can be processed.
   533 
   537 
   534     Args:
   538     Args:
   535       request: the standard Django HTTP request object
   539       request: the standard Django HTTP request object
   536       access_type : the name of the access type which should be checked
   540       access_type : the name of the access type which should be checked
   594     if request_entity:
   598     if request_entity:
   595       # already outstanding request
   599       # already outstanding request
   596       return False
   600       return False
   597 
   601 
   598     # check if the role already exists
   602     # check if the role already exists
   599     fields = {'scope' : request_fields['scope'],
   603     fields = {'scope': request_fields['scope'],
   600         'link_id': request_fields['link_id'],
   604         'link_id': request_fields['link_id'],
   601         'status': ['active','inactive'],
   605         'status': ['active','inactive'],
   602         }
   606         }
   603 
   607 
   604     role_entity = params['logic'].getForFields(fields, unique=True)
   608     role_entity = params['logic'].getForFields(fields, unique=True)