app/soc/views/models/user_self.py
changeset 2205 77273200ab4f
parent 1986 5375e657a715
child 2360 e389d26949db
equal deleted inserted replaced
2204:ccbc8bb5ce86 2205:77273200ab4f
   136     super(View, self).__init__(params=params)
   136     super(View, self).__init__(params=params)
   137 
   137 
   138   @decorators.merge_params
   138   @decorators.merge_params
   139   @decorators.check_access
   139   @decorators.check_access
   140   def editProfile(self, request, access_type,
   140   def editProfile(self, request, access_type,
   141            page_name=None, params=None, seed=None, **kwargs):
   141            page_name=None, params=None, **kwargs):
   142     """Displays User profile edit page for the current user.
   142     """Displays User profile edit page for the current user.
   143 
   143 
   144     Args:
   144     Args:
   145       request: the standard Django HTTP request object
   145       request: the standard Django HTTP request object
   146       page_name: the page name displayed in templates as page and header title
   146       page_name: the page name displayed in templates as page and header title
   151     # set the link_id to the current user's link_id
   151     # set the link_id to the current user's link_id
   152     user_entity = user_logic.getForCurrentAccount()
   152     user_entity = user_logic.getForCurrentAccount()
   153     link_id = user_entity.link_id
   153     link_id = user_entity.link_id
   154 
   154 
   155     return self.edit(request, access_type, page_name=page_name, 
   155     return self.edit(request, access_type, page_name=page_name, 
   156         params=params, seed=seed, link_id=link_id, **kwargs)
   156         params=params, link_id=link_id, **kwargs)
   157 
   157 
   158   def editGet(self, request, entity, context, seed, params=None):
   158   def editGet(self, request, entity, context, params=None):
   159     """Overwrite so we can add the contents of the ToS.
   159     """Overwrite so we can add the contents of the ToS.
   160     For params see base.View.editGet().
   160     For params see base.View.editGet().
   161     """
   161     """
   162 
   162 
   163     s_logic = model_logic.site.logic
   163     s_logic = model_logic.site.logic
   164     site_tos = s_logic.getToS(s_logic.getSingleton())
   164     site_tos = s_logic.getToS(s_logic.getSingleton())
   165     if site_tos:
   165     if site_tos:
   166       context['tos_contents'] = site_tos.content
   166       context['tos_contents'] = site_tos.content
   167 
   167 
   168     return super(View, self).editGet(request, entity, context, 
   168     return super(View, self).editGet(request, entity, context, params=params)
   169         seed, params=params)
       
   170 
   169 
   171   def _editGet(self, request, entity, form):
   170   def _editGet(self, request, entity, form):
   172     """Sets the content of the agreed_to_tos_on field and replaces.
   171     """Sets the content of the agreed_to_tos_on field and replaces.
   173 
   172 
   174     Also replaces the agreed_to_tos field with a hidden field when the ToS has been signed.
   173     Also replaces the agreed_to_tos field with a hidden field when the ToS has been signed.