equal
deleted
inserted
replaced
142 """ |
142 """ |
143 |
143 |
144 if 'home_link_id' not in fields: |
144 if 'home_link_id' not in fields: |
145 return super(View, self)._editPost(request, entity, fields) |
145 return super(View, self)._editPost(request, entity, fields) |
146 |
146 |
|
147 if not fields['home_link_id'] and entity.home: |
|
148 properties = {'home_for': None} |
|
149 document_logic.logic.updateEntityProperties(entity.home, properties) |
|
150 |
147 scope_path = self._logic.getKeyNameFromFields(fields) |
151 scope_path = self._logic.getKeyNameFromFields(fields) |
148 |
152 |
149 key_fields = { |
153 key_fields = { |
150 'scope_path': scope_path, |
154 'scope_path': scope_path, |
151 'link_id': fields['home_link_id'], |
155 'link_id': fields['home_link_id'], |
155 # TODO notify the user if home_doc is not found |
159 # TODO notify the user if home_doc is not found |
156 home_doc = document_logic.logic.getFromKeyFields(key_fields) |
160 home_doc = document_logic.logic.getFromKeyFields(key_fields) |
157 |
161 |
158 fields['home'] = home_doc |
162 fields['home'] = home_doc |
159 |
163 |
|
164 if home_doc: |
|
165 properties = {'home_for': entity} |
|
166 document_logic.logic.updateEntityProperties(home_doc, properties) |
|
167 |
160 super(View, self)._editPost(request, entity, fields) |
168 super(View, self)._editPost(request, entity, fields) |