@require_GET
def compare_revisions(request, document_slug):
 locale = request.GET.get('locale', request.LANGUAGE_CODE)
 doc = get_object_or_404(Document, locale=locale, slug=document_slug)
 if (('from' not in request.GET) or ('to' not in request.GET)):
  raise Http404
 from_id = smart_int(request.GET.get('from'))
 to_id = smart_int(request.GET.get('to'))
 revision_from = get_object_or_404(Revision, document=doc, id=from_id)
 revision_to = get_object_or_404(Revision, document=doc, id=to_id)
 if request.is_ajax():
  template = 'wiki/includes/revision_diff.html'
 else:
  template = 'wiki/compare_revisions.html'
 return render(request, template, {'document': doc, 'revision_from': revision_from, 'revision_to': revision_to})

@ require_GET def compare_revisions ( request , document_slug ) : locale = request . GET . get ( 'locale' , request . LANGUAGE_CODE ) doc = get_object_or_404 ( Document , locale = locale , slug = document_slug ) if ( ( 'from' not in request . GET ) or ( 'to' not in request . GET ) ) : raise Http404 from_id = smart_int ( request . GET . get ( 'from' ) ) to_id = smart_int ( request . GET . get ( 'to' ) ) revision_from = get_object_or_404 ( Revision , document = doc , id = from_id ) revision_to = get_object_or_404 ( Revision , document = doc , id = to_id ) if request . is_ajax ( ) : template = 'wiki/includes/revision_diff.html' else : template = 'wiki/compare_revisions.html' return render ( request , template , { 'document' : doc , 'revision_from' : revision_from , 'revision_to' : revision_to } )
compare two wiki document revisions .