app/soc/views/models/student_proposal.py
changeset 2160 3f9dd37d98a8
parent 2150 5c125051252e
child 2173 27731db8ab1e
equal deleted inserted replaced
2159:a1f1eaaf458b 2160:3f9dd37d98a8
   395       user_entity = user_logic.logic.getForCurrentAccount()
   395       user_entity = user_logic.logic.getForCurrentAccount()
   396 
   396 
   397       # create the fields that should be in the ReviewFollower entity
   397       # create the fields that should be in the ReviewFollower entity
   398       fields = {'link_id': user_entity.link_id,
   398       fields = {'link_id': user_entity.link_id,
   399                 'scope': entity,
   399                 'scope': entity,
   400                 'scope_path': entity.key().name(),
   400                 'scope_path': entity.key().id_or_name(),
   401                 'user': user_entity
   401                 'user': user_entity
   402                }
   402                }
   403       # get the keyname for the ReviewFollower entity
   403       # get the keyname for the ReviewFollower entity
   404       key_name = review_follower_logic.getKeyNameFromFields(fields)
   404       key_name = review_follower_logic.getKeyNameFromFields(fields)
   405 
   405 
   546 
   546 
   547     list_params = org_view.view.getParams().copy()
   547     list_params = org_view.view.getParams().copy()
   548     list_params['list_description'] = ('List of %(name_plural)s you can send '
   548     list_params['list_description'] = ('List of %(name_plural)s you can send '
   549         'your proposal to.') % list_params
   549         'your proposal to.') % list_params
   550     list_params['list_action'] = (redirects.getStudentProposalRedirect,
   550     list_params['list_action'] = (redirects.getStudentProposalRedirect,
   551         {'student_key': student_entity.key().name(),
   551         {'student_key': student_entity.key().id_or_name(),
   552             'url_name': params['url_name']})
   552             'url_name': params['url_name']})
   553 
   553 
   554     return self.list(request, access_type=access_type, page_name=page_name,
   554     return self.list(request, access_type=access_type, page_name=page_name,
   555                      params=list_params, filter=filter, **kwargs)
   555                      params=list_params, filter=filter, **kwargs)
   556 
   556 
   793       user_entity = user_logic.logic.getForCurrentAccount()
   793       user_entity = user_logic.logic.getForCurrentAccount()
   794 
   794 
   795       # create the fields that should be in the ReviewFollower entity
   795       # create the fields that should be in the ReviewFollower entity
   796       fields = {'link_id': user_entity.link_id,
   796       fields = {'link_id': user_entity.link_id,
   797                 'scope': entity,
   797                 'scope': entity,
   798                 'scope_path': entity.key().name(),
   798                 'scope_path': entity.key().id_or_name(),
   799                 'user': user_entity
   799                 'user': user_entity
   800                }
   800                }
   801       # get the keyname for the ReviewFollower entity
   801       # get the keyname for the ReviewFollower entity
   802       key_name = review_follower_logic.getKeyNameFromFields(fields)
   802       key_name = review_follower_logic.getKeyNameFromFields(fields)
   803 
   803 
   893       context['possible_mentors'] = "None"
   893       context['possible_mentors'] = "None"
   894     else:
   894     else:
   895       mentor_names = []
   895       mentor_names = []
   896 
   896 
   897       for mentor_key in possible_mentors:
   897       for mentor_key in possible_mentors:
   898         possible_mentor = mentor_logic.logic.getFromKeyName(mentor_key.name())
   898         possible_mentor = mentor_logic.logic.getFromKeyName(mentor_key.id_or_name())
   899         mentor_names.append(possible_mentor.name())
   899         mentor_names.append(possible_mentor.id_or_name())
   900 
   900 
   901       context['possible_mentors'] = ', '.join(mentor_names)
   901       context['possible_mentors'] = ', '.join(mentor_names)
   902 
   902 
   903     # TODO(ljvderijk) listing of total given scores per mentor
   903     # TODO(ljvderijk) listing of total given scores per mentor
   904     # a dict with key as role.user ?
   904     # a dict with key as role.user ?
  1013     from soc.logic.models.review_follower import logic as review_follower_logic
  1013     from soc.logic.models.review_follower import logic as review_follower_logic
  1014 
  1014 
  1015     # create the fields for the review entity
  1015     # create the fields for the review entity
  1016     fields = {'link_id': 't%i' % (int(time.time()*100)),
  1016     fields = {'link_id': 't%i' % (int(time.time()*100)),
  1017         'scope': entity,
  1017         'scope': entity,
  1018         'scope_path': entity.key().name(),
  1018         'scope_path': entity.key().id_or_name(),
  1019         'author': user_logic.logic.getForCurrentAccount(),
  1019         'author': user_logic.logic.getForCurrentAccount(),
  1020         'content': comment,
  1020         'content': comment,
  1021         'is_public': is_public,
  1021         'is_public': is_public,
  1022         'reviewer': reviewer
  1022         'reviewer': reviewer
  1023         }
  1023         }