def text_embed(request, key): text = get_text_by_keys_or_404(key) embed_code = embed_html(text.key) template_dict = {'text': text, 'embed_code': embed_code} return render_to_response('site/text_embed.html', template_dict, context_instance=RequestContext(request))
def text_view(request, key, adminkey=None): text = get_text_by_keys_or_404(key) register_activity(request, "text_view", text=text) text_version = text.get_latest_version() embed_code = embed_html(key, 'id="text_view_frame" name="text_view_frame" onload="if (window.iframe_onload) iframe_onload();"', None, request.META.get('QUERY_STRING')) template_dict = { 'embed_code':embed_code, 'text' : text, 'text_version' : text_version, 'title' : text_version.title} return render_to_response('site/text_view.html', template_dict, context_instance=RequestContext(request))
def read(self, request, key): text = get_text_by_keys_or_404(key) setattr(text,'nb_comments',len(get_viewable_comments(request, text.last_text_version.comment_set.all(), text))) setattr(text,'nb_versions',text.get_versions_number()) setattr(text,'embed_html',embed_html(text.key)) return text
def text_embed(request, key): text = get_text_by_keys_or_404(key) embed_code = embed_html(text.key) ; template_dict = { 'text' : text, 'embed_code': embed_code } return render_to_response('site/text_embed.html', template_dict , context_instance=RequestContext(request))
def text_history_version(request, key, version_key): text = get_text_by_keys_or_404(key) text_version = get_textversion_by_keys_or_404(version_key, key=key) text_versions = text.get_versions() first_version = text_versions[len(text_versions) - 1] template_dict = {'text' : text, 'text_version' : text_version, 'embed_code' : embed_html(key, 'id="text_view_frame" name="text_view_frame"', version_key), 'first_version':first_version, } return render_to_response('site/text_history_version.html', template_dict, context_instance=RequestContext(request))