equal
deleted
inserted
replaced
109 def _editPost(self, request, entity, fields): |
109 def _editPost(self, request, entity, fields): |
110 """See base.View._editPost(). |
110 """See base.View._editPost(). |
111 """ |
111 """ |
112 |
112 |
113 if not entity: |
113 if not entity: |
114 # creating a new group application |
|
115 key_fields = self._logic.getKeyFieldsFromFields(fields) |
|
116 group_app_entity = self._logic.getForFields(key_fields, unique=True) |
|
117 |
|
118 user_entity = user_logic.logic.getForCurrentAccount() |
|
119 |
|
120 if group_app_entity and ( |
|
121 group_app_entity.applicant.key() != user_entity.key()): |
|
122 # someone else is applying remove the existing group application |
|
123 group_app_logic.logic.delete(group_app_entity) |
|
124 |
|
125 # set the applicant field to the current user |
114 # set the applicant field to the current user |
126 fields['applicant'] = user_entity |
115 fields['applicant'] = user_logic.logic.getForCurrentAccount() |
127 |
116 |
128 #set the backup_admin field with the cleaned link_id |
117 #set the backup_admin field with the cleaned link_id |
129 fields['backup_admin'] = fields['backup_admin_link_id'] |
118 fields['backup_admin'] = fields['backup_admin_link_id'] |
130 |
119 |
131 # the application has either been created or edited so |
120 # the application has either been created or edited so |