35 |
35 |
36 from soc.logic import out_of_band |
36 from soc.logic import out_of_band |
37 from soc.logic import feed |
37 from soc.logic import feed |
38 from soc.logic.site import id_user |
38 from soc.logic.site import id_user |
39 from soc.views import simple |
39 from soc.views import simple |
|
40 from soc.views.helpers import custom_widgets |
40 from soc.views.helpers import forms_helpers |
41 from soc.views.helpers import forms_helpers |
41 from soc.views.helpers import response_helpers |
42 from soc.views.helpers import response_helpers |
42 from soc.views.helpers import template_helpers |
43 from soc.views.helpers import template_helpers |
43 from soc.views.helpers import custom_widgets |
|
44 |
44 |
45 import soc.models.site_settings |
45 import soc.models.site_settings |
46 import soc.models.document |
46 import soc.models.document |
47 import soc.logic.document |
47 import soc.logic.document |
48 import soc.logic.site.settings |
48 import soc.logic.site.settings |
57 """ |
57 """ |
58 #: db.Model subclass for which the form will gather information |
58 #: db.Model subclass for which the form will gather information |
59 model = soc.models.document.Document |
59 model = soc.models.document.Document |
60 |
60 |
61 #: list of model fields which will *not* be gathered by the form |
61 #: list of model fields which will *not* be gathered by the form |
62 exclude = ['user','modified','created','link_name', 'inheritance_line'] |
62 exclude = ['partial_path', 'link_name', |
|
63 'user', 'modified', 'created', 'inheritance_line'] |
63 |
64 |
64 |
65 |
65 class SiteSettingsForm(forms_helpers.DbModelForm): |
66 class SiteSettingsForm(forms_helpers.DbModelForm): |
66 """Django form displayed when creating or editing Site Settings. |
67 """Django form displayed when creating or editing Site Settings. |
67 """ |
68 """ |
167 short_name = document_form.cleaned_data.get('short_name') |
168 short_name = document_form.cleaned_data.get('short_name') |
168 abstract = document_form.cleaned_data.get('abstract') |
169 abstract = document_form.cleaned_data.get('abstract') |
169 content = document_form.cleaned_data.get('content') |
170 content = document_form.cleaned_data.get('content') |
170 |
171 |
171 site_doc = soc.logic.document.updateOrCreateDocument( |
172 site_doc = soc.logic.document.updateOrCreateDocument( |
172 DEF_SITE_SETTINGS_PATH, link_name=link_name, title=title, |
173 partial_path=DEF_SITE_SETTINGS_PATH, link_name=link_name, |
173 short_name=short_name, abstract=abstract, content=content, |
174 title=title, short_name=short_name, abstract=abstract, |
174 user=id_user.getUserFromId(logged_in_id)) |
175 content=content, user=id_user.getUserFromId(logged_in_id)) |
175 |
176 |
176 feed_url = settings_form.cleaned_data.get('feed_url') |
177 feed_url = settings_form.cleaned_data.get('feed_url') |
177 |
178 |
178 site_settings = soc.logic.site.settings.updateOrCreateSiteSettings( |
179 site_settings = soc.logic.site.settings.updateOrCreateSiteSettings( |
179 DEF_SITE_SETTINGS_PATH, home=site_doc, feed_url=feed_url) |
180 DEF_SITE_SETTINGS_PATH, home=site_doc, feed_url=feed_url) |