63 #: db.Model subclass for which the form will gather information |
63 #: db.Model subclass for which the form will gather information |
64 model = soc.models.document.Document |
64 model = soc.models.document.Document |
65 |
65 |
66 #: list of model fields which will *not* be gathered by the form |
66 #: list of model fields which will *not* be gathered by the form |
67 exclude = ['partial_path', 'link_name', |
67 exclude = ['partial_path', 'link_name', |
68 'founder', 'modified', 'created', 'inheritance_line'] |
68 'author', 'modified', 'created', 'inheritance_line'] |
69 |
69 |
70 |
70 |
71 class SiteSettingsForm(helper.forms.DbModelForm): |
71 class SiteSettingsForm(helper.forms.DbModelForm): |
72 """Django form displayed when creating or editing Site Settings. |
72 """Django form displayed when creating or editing Site Settings. |
73 """ |
73 """ |
160 |
160 |
161 if document_form.is_valid() and settings_form.is_valid(): |
161 if document_form.is_valid() and settings_form.is_valid(): |
162 link_name = DEF_SITE_HOME_DOC_LINK_NAME |
162 link_name = DEF_SITE_HOME_DOC_LINK_NAME |
163 partial_path=DEF_SITE_SETTINGS_PATH |
163 partial_path=DEF_SITE_SETTINGS_PATH |
164 logged_in_id = users.get_current_user() |
164 logged_in_id = users.get_current_user() |
165 founder = models.user.logic.getFromFields(email=logged_in_id.email()) |
165 author = models.user.logic.getFromFields(email=logged_in_id.email()) |
166 |
166 |
167 properties = { |
167 properties = { |
168 'title': document_form.cleaned_data.get('title'), |
168 'title': document_form.cleaned_data.get('title'), |
169 'short_name': document_form.cleaned_data.get('short_name'), |
169 'short_name': document_form.cleaned_data.get('short_name'), |
170 'abstract': document_form.cleaned_data.get('abstract'), |
170 'abstract': document_form.cleaned_data.get('abstract'), |
171 'content': document_form.cleaned_data.get('content'), |
171 'content': document_form.cleaned_data.get('content'), |
172 'link_name': link_name, |
172 'link_name': link_name, |
173 'partial_path': partial_path, |
173 'partial_path': partial_path, |
174 'id': logged_in_id, |
174 'id': logged_in_id, |
175 'founder': founder, |
175 'author': author, |
176 } |
176 } |
177 |
177 |
178 site_doc = document.logic.updateOrCreateFromFields( |
178 site_doc = document.logic.updateOrCreateFromFields( |
179 properties, partial_path=partial_path, link_name=link_name) |
179 properties, partial_path=partial_path, link_name=link_name) |
180 |
180 |