def response_from_db_or_default(module, view, pagename, active_key=None): response_dictionary = {"contents": {"pagename": pagename, "module": module, "view": view, "title": ""}} appview = get_template_by_model_view(module, view) if appview: if appview.is_redirect: return HttpResponseRedirect(appview.url) response_dictionary["contents"]["pagename"] = appview.pagename response_dictionary["contents"]["title"] = appview.caption active_key = view if active_key else active_key response_dictionary["contents"]["h_%s" % active_key] = "active" if hasattr(appview, 'default_content') and appview.default_content: logging.info("@@@@@ Using Default Content") content = appview.default_content.content else: logging.info("@@@@@ Searching AppContents") content = get_content_string_by_tile(module + "-" + view) response_dictionary["contents"]["content"] = content if hasattr(appview, 'template') and appview.template: logging.info("@@@@@ Template Found") return response_from_string(appview.template.content, response_dictionary) else: logging.info("@@@@@ Template NOT Found") return render_to_response('layout/default.html', response_dictionary) else: raise Http404("Page Not Available")
def response_from_db_or_default(module, view, pagename, active_key=None): response_dictionary = { "contents": { "pagename": pagename, "module": module, "view": view, "title": "" } } appview = get_template_by_model_view(module, view) if appview: if appview.is_redirect: return HttpResponseRedirect(appview.url) response_dictionary["contents"]["pagename"] = appview.pagename response_dictionary["contents"]["title"] = appview.caption active_key = view if active_key else active_key response_dictionary["contents"]["h_%s" % active_key] = "active" if hasattr(appview, 'default_content') and appview.default_content: logging.info("@@@@@ Using Default Content") content = appview.default_content.content else: logging.info("@@@@@ Searching AppContents") content = get_content_string_by_tile(module + "-" + view) response_dictionary["contents"]["content"] = content if hasattr(appview, 'template') and appview.template: logging.info("@@@@@ Template Found") return response_from_string(appview.template.content, response_dictionary) else: logging.info("@@@@@ Template NOT Found") return render_to_response('layout/default.html', response_dictionary) else: raise Http404("Page Not Available")
def contents_tile(tile_id): return get_content_string_by_tile(str(tile_id))
def contents_tile(tile_id): content, content_id = get_content_string_by_tile(str(tile_id)) return content