@require_GET
def document_revisions(request, document_slug, contributor_form=None):
 locale = request.GET.get('locale', request.LANGUAGE_CODE)
 try:
  doc = Document.objects.get(locale=locale, slug=document_slug)
 except Document.DoesNotExist:
  parent_doc = get_object_or_404(Document, locale=settings.WIKI_DEFAULT_LANGUAGE, slug=document_slug)
  translation = parent_doc.translated_to(locale)
  if translation:
   url = reverse('wiki.document_revisions', args=[translation.slug], locale=locale)
   return HttpResponseRedirect(url)
  else:
   raise Http404
 revs = Revision.objects.filter(document=doc).order_by('-created', '-id')
 if request.is_ajax():
  template = 'wiki/includes/revision_list.html'
 else:
  template = 'wiki/history.html'
 form = (contributor_form or AddContributorForm())
 return render(request, template, {'revisions': revs, 'document': doc, 'contributor_form': form})

@ require_GET def document_revisions ( request , document_slug , contributor_form = None ) : locale = request . GET . get ( 'locale' , request . LANGUAGE_CODE ) try : doc = Document . objects . get ( locale = locale , slug = document_slug ) except Document . DoesNotExist : parent_doc = get_object_or_404 ( Document , locale = settings . WIKI_DEFAULT_LANGUAGE , slug = document_slug ) translation = parent_doc . translated_to ( locale ) if translation : url = reverse ( 'wiki.document_revisions' , args = [ translation . slug ] , locale = locale ) return HttpResponseRedirect ( url ) else : raise Http404 revs = Revision . objects . filter ( document = doc ) . order_by ( '-created' , '-id' ) if request . is_ajax ( ) : template = 'wiki/includes/revision_list.html' else : template = 'wiki/history.html' form = ( contributor_form or AddContributorForm ( ) ) return render ( request , template , { 'revisions' : revs , 'document' : doc , 'contributor_form' : form } )
list all the revisions of a given document .