X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/6c42fa79857901ddc1c7044d4478f52a6b454014..8aa768e4480f62eed277c3d530cfbc1c8961765e:/apps/wiki/views.py?ds=inline diff --git a/apps/wiki/views.py b/apps/wiki/views.py index 5128b569..461f1109 100644 --- a/apps/wiki/views.py +++ b/apps/wiki/views.py @@ -69,7 +69,8 @@ def editor(request, pk, template_name='wiki/bootstrap.html'): 'version': len(history), 'revision': revision.pk, 'stage': doc.stage, - 'assignment': str(doc.assigned_to), + 'stage_name': doc.stage_name(), + 'assignment': doc.assigned_to.username if doc.assigned_to else None, }), 'serialized_templates': json.dumps([ {'id': t.id, 'name': t.name, 'content': t.content} for t in Template.objects.filter(is_partial=True) @@ -120,11 +121,11 @@ def text(request, doc_id): from traceback import print_exc print_exc() raise - # revision = doc.revision() return JSONResponse({ 'text': None, # doc.materialize() if parent_revision != revision else None, - # 'version': revision, - # 'stage': doc.stage.name if doc.stage else None, + 'version': len(get_history(doc)), + 'stage': doc.stage, + 'stage_name': doc.stage_name(), 'assignment': doc.assigned_to.username if doc.assigned_to else None }) else: @@ -177,8 +178,11 @@ def revert(request, doc_id): ) return JSONResponse({ - # 'document': None, #doc.materialize() if before != doc.revision else None, - # 'version': doc.revision(), + 'document': doc.materialize(), + 'version': len(get_history(doc)), + 'stage': doc.stage, + 'stage_name': doc.stage_name(), + 'assignment': doc.assigned_to.username if doc.assigned_to else None, }) else: return JSONFormInvalid(form)