46 """Django form displayed when creating or editing Settings. |
46 """Django form displayed when creating or editing Settings. |
47 |
47 |
48 This form includes validation functions for Settings fields. |
48 This form includes validation functions for Settings fields. |
49 """ |
49 """ |
50 |
50 |
51 # TODO(tlarsen): partial_path will be a hard-coded read-only |
51 # TODO(tlarsen): scope_path will be a hard-coded read-only |
52 # field for some (most?) User Roles |
52 # field for some (most?) User Roles |
53 doc_partial_path = forms.CharField(required=False, |
53 doc_scope_path = forms.CharField(required=False, |
54 label=ugettext_lazy('Document partial path'), |
54 label=ugettext_lazy('Document scope path'), |
55 help_text=soc.models.work.Work.partial_path.help_text) |
55 help_text=soc.models.work.Work.scope_path.help_text) |
56 |
56 |
57 # TODO(tlarsen): actually, using these two text fields to specify |
57 # TODO(tlarsen): actually, using these two text fields to specify |
58 # the Document is pretty cheesy; this needs to be some much better |
58 # the Document is pretty cheesy; this needs to be some much better |
59 # Role-scoped Document selector that we don't have yet |
59 # Role-scoped Document selector that we don't have yet |
60 doc_link_id = forms.CharField(required=False, |
60 doc_link_id = forms.CharField(required=False, |
164 """See base.View._editGet(). |
164 """See base.View._editGet(). |
165 """ |
165 """ |
166 |
166 |
167 try: |
167 try: |
168 if entity.home: |
168 if entity.home: |
169 form.fields['doc_partial_path'].initial = entity.home.partial_path |
169 form.fields['doc_scope_path'].initial = entity.home.scope_path |
170 form.fields['doc_link_id'].initial = entity.home.link_id |
170 form.fields['doc_link_id'].initial = entity.home.link_id |
171 except db.Error: |
171 except db.Error: |
172 pass |
172 pass |
173 |
173 |
174 def _editPost(self, request, entity, fields): |
174 def _editPost(self, request, entity, fields): |
175 """See base.View._editPost(). |
175 """See base.View._editPost(). |
176 """ |
176 """ |
177 |
177 |
178 doc_partial_path = fields['doc_partial_path'] |
178 doc_scope_path = fields['doc_scope_path'] |
179 doc_link_id = fields['doc_link_id'] |
179 doc_link_id = fields['doc_link_id'] |
180 |
180 |
181 # TODO notify the user if home_doc is not found |
181 # TODO notify the user if home_doc is not found |
182 home_doc = document_logic.logic.getFromFields( |
182 home_doc = document_logic.logic.getFromFields( |
183 partial_path=doc_partial_path, link_id=doc_link_id) |
183 scope_path=doc_scope_path, link_id=doc_link_id) |
184 |
184 |
185 fields['home'] = home_doc |
185 fields['home'] = home_doc |
186 |
186 |
187 |
187 |
188 view = View() |
188 view = View() |