from django.shortcuts import get_object_or_404, render
from django.utils import simplejson
-from catalogue.models import Book, Chunk
+from catalogue.models import Book, Chunk, Template
import nice_diff
from wiki import forms
from wiki.helpers import (JSONResponse, JSONFormInvalid, JSONServerError,
'history': get_history(chunk),
'version': chunk.revision()
}),
+ 'serialized_templates': simplejson.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")
doc.at_revision(revision).revert(author=author, description=comment)
return JSONResponse({
- 'text': doc.materialize() if before != doc.revision() else None,
+ 'document': doc.materialize() if before != doc.revision() else None,
'meta': {},
- 'revision': doc.revision(),
+ 'version': doc.revision(),
})
else:
return JSONFormInvalid(form)