app/soc/views/site/home.py
changeset 285 52e206a6a417
parent 274 56e1c1721299
child 290 2a92b866ed40
equal deleted inserted replaced
284:44abd20296ce 285:52e206a6a417
   107   context = helper.responses.getUniversalContext(request)
   107   context = helper.responses.getUniversalContext(request)
   108   
   108   
   109   site_settings = soc.logic.site.settings.getSiteSettings(DEF_SITE_SETTINGS_PATH)
   109   site_settings = soc.logic.site.settings.getSiteSettings(DEF_SITE_SETTINGS_PATH)
   110 
   110 
   111   if site_settings:
   111   if site_settings:
   112     context.update({'site_settings': site_settings})
   112     context['site_settings'] = site_settings
   113     site_doc = site_settings.home
   113     site_doc = site_settings.home
   114   
   114   
   115     if site_doc:
   115     if site_doc:
   116       site_doc.content = helper.templates.unescape(site_doc.content)
   116       site_doc.content = helper.templates.unescape(site_doc.content)
   117       context.update({'site_document': site_doc})
   117       context['site_document'] = site_doc
   118 
   118 
   119   return helper.responses.respond(request, template, context)
   119   return helper.responses.respond(request, template, context)
   120 
   120 
   121 
   121 
   122 DEF_SITE_HOME_EDIT_TMPL = 'soc/site/home/edit.html'
   122 DEF_SITE_HOME_EDIT_TMPL = 'soc/site/home/edit.html'
   177       feed_url = settings_form.cleaned_data.get('feed_url')
   177       feed_url = settings_form.cleaned_data.get('feed_url')
   178 
   178 
   179       site_settings = soc.logic.site.settings.updateOrCreateSiteSettings(
   179       site_settings = soc.logic.site.settings.updateOrCreateSiteSettings(
   180           DEF_SITE_SETTINGS_PATH, home=site_doc, feed_url=feed_url)
   180           DEF_SITE_SETTINGS_PATH, home=site_doc, feed_url=feed_url)
   181       
   181       
   182       context.update({'submit_message': 'Site Settings saved.'})
   182       context['submit_message'] = 'Site Settings saved.'
   183   else: # request.method == 'GET'
   183   else: # request.method == 'GET'
   184     # try to fetch SiteSettings entity by unique key_name
   184     # try to fetch SiteSettings entity by unique key_name
   185     site_settings = soc.logic.site.settings.getSiteSettings(
   185     site_settings = soc.logic.site.settings.getSiteSettings(
   186         DEF_SITE_SETTINGS_PATH)
   186         DEF_SITE_SETTINGS_PATH)
   187 
   187