app/soc/views/site/home.py
changeset 317 87215136c268
parent 314 dfaf249c12b2
child 319 4e336befdf86
equal deleted inserted replaced
316:9efdc7bc3565 317:87215136c268
   161       partial_path=DEF_SITE_SETTINGS_PATH
   161       partial_path=DEF_SITE_SETTINGS_PATH
   162       logged_in_id = users.get_current_user()
   162       logged_in_id = users.get_current_user()
   163       user = models.user.logic.getFromFields(email=logged_in_id)
   163       user = models.user.logic.getFromFields(email=logged_in_id)
   164 
   164 
   165       properties = {
   165       properties = {
   166         'title' : document_form.cleaned_data.get('title'),
   166         'title': document_form.cleaned_data.get('title'),
   167         'short_name' : document_form.cleaned_data.get('short_name'),
   167         'short_name': document_form.cleaned_data.get('short_name'),
   168         'abstract' : document_form.cleaned_data.get('abstract'),
   168         'abstract': document_form.cleaned_data.get('abstract'),
   169         'content' : document_form.cleaned_data.get('content'),
   169         'content': document_form.cleaned_data.get('content'),
   170         'link_name' : link_name,
   170         'link_name': link_name,
   171         'partial_path' : partial_path,
   171         'partial_path': partial_path,
   172         'id' : logged_in_id,
   172         'id': logged_in_id,
   173         'user' : user,
   173         'user': user,
   174       }
   174       }
   175 
   175 
   176       site_doc = document.logic.updateOrCreateFromFields(
   176       site_doc = document.logic.updateOrCreateFromFields(
   177           properties, partial_path=partial_path, link_name=link_name)
   177           properties, partial_path=partial_path, link_name=link_name)
   178       
   178       
   179       feed_url = settings_form.cleaned_data.get('feed_url')
   179       feed_url = settings_form.cleaned_data.get('feed_url')
   180 
   180 
   181       site_settings = models.settings.logic.updateOrCreateFromFields(
   181       site_settings = models.settings.logic.updateOrCreateFromFields(
   182           {'feed_url' : feed_url, 'home' : site_doc}, path=DEF_SITE_SETTINGS_PATH)
   182           {'feed_url': feed_url, 'home': site_doc}, path=DEF_SITE_SETTINGS_PATH)
   183       
   183       
   184       context['notice'] = 'Site Settings saved.'
   184       context['notice'] = 'Site Settings saved.'
   185   else: # request.method == 'GET'
   185   else: # request.method == 'GET'
   186     # try to fetch SiteSettings entity by unique key_name
   186     # try to fetch SiteSettings entity by unique key_name
   187     site_settings = models.settings.logic.getFromFields(
   187     site_settings = models.settings.logic.getFromFields(