@login_required
@require_POST
def preview_revision(request):
 wiki_content = request.POST.get('content', '')
 slug = request.POST.get('slug')
 locale = request.POST.get('locale')
 statsd.incr('wiki.preview')
 if (slug and locale):
  doc = get_object_or_404(Document, slug=slug, locale=locale)
  products = doc.get_products()
 else:
  products = Product.objects.all()
 data = {'content': wiki_to_html(wiki_content, request.LANGUAGE_CODE), 'products': products}
 return render(request, 'wiki/preview.html', data)

@ login_required @ require_POST def preview_revision ( request ) : wiki_content = request . POST . get ( 'content' , '' ) slug = request . POST . get ( 'slug' ) locale = request . POST . get ( 'locale' ) statsd . incr ( 'wiki.preview' ) if ( slug and locale ) : doc = get_object_or_404 ( Document , slug = slug , locale = locale ) products = doc . get_products ( ) else : products = Product . objects . all ( ) data = { 'content' : wiki_to_html ( wiki_content , request . LANGUAGE_CODE ) , 'products' : products } return render ( request , 'wiki/preview.html' , data )
create an html fragment preview of the posted wiki syntax .