+ version = int(request.GET.get('version', None))
+ except:
+ version = None
+ if version:
+ text = doc.at_revision(version).materialize()
+ else:
+ text = doc.materialize()
+ revision = doc.revision
+ history = get_history(doc)
+ return render(request, template_name, {
+ 'serialized_document_data': json.dumps({
+ 'document': text,
+ 'document_id': doc.pk,
+ 'title': doc.meta().get('title', ''),
+ 'history': history,
+ 'version': len(history), #version or chunk.revision(),
+ 'revision': revision.pk,
+ 'stage': doc.stage,
+ 'assignment': str(doc.assigned_to),
+ }),
+ 'serialized_templates': json.dumps([
+ {'id': t.id, 'name': t.name, 'content': t.content} for t in Template.objects.filter(is_partial=True)
+ ]),
+ 'forms': {
+ "text_save": save_form,
+ "text_revert": forms.DocumentTextRevertForm(prefix="textrevert"),
+ "text_publish": forms.DocumentTextPublishForm(prefix="textpublish"),
+ },
+ 'pk': doc.pk,
+ })
+
+
+@require_GET
+def editor_readonly(request, slug, chunk=None, template_name='wiki/document_details_readonly.html'):
+ try:
+ chunk = Chunk.get(slug, chunk)
+ revision = request.GET['revision']
+ except (Chunk.MultipleObjectsReturned, Chunk.DoesNotExist, KeyError):