X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/5780495e13ec2d55bc2dee96dec372a9ea395462..e77f342a73c940f16c37f57ffa50edce9caef8f0:/apps/wiki/views.py?ds=inline diff --git a/apps/wiki/views.py b/apps/wiki/views.py index 69c98365..c41edd38 100644 --- a/apps/wiki/views.py +++ b/apps/wiki/views.py @@ -194,6 +194,24 @@ def text(request, name): }) +@never_cache +@normalized_name +@require_POST +def revert(request, name): + storage = getstorage() + revision = request.POST['target_revision'] + + try: + document = storage.revert(name, revision) + + return JSONResponse({ + 'text': document.plain_text if revision != document.revision else None, + 'meta': document.meta(), + 'revision': document.revision, + }) + except DocumentNotFound: + raise http.Http404 + @never_cache def gallery(request, directory): try: