def invoice(request, order_id, template=u'shop/order_invoice.html', template_pdf=u'shop/order_invoice_pdf.html', extra_context=None):
 try:
  order = Order.objects.get_for_user(order_id, request)
 except Order.DoesNotExist:
  raise Http404
 context = {u'order': order}
 context.update(order.details_as_dict())
 context.update((extra_context or {}))
 if (HAS_PDF and (request.GET.get(u'format') == u'pdf')):
  response = HttpResponse(content_type=u'application/pdf')
  name = slugify((u'%s-invoice-%s' % (settings.SITE_TITLE, order.id)))
  response[u'Content-Disposition'] = (u'attachment; filename=%s.pdf' % name)
  html = get_template(template_pdf).render(context)
  pisa.CreatePDF(html, response)
  return response
 return TemplateResponse(request, template, context)

def invoice ( request , order_id , template = u'shop/order_invoice.html' , template_pdf = u'shop/order_invoice_pdf.html' , extra_context = None ) : try : order = Order . objects . get_for_user ( order_id , request ) except Order . DoesNotExist : raise Http404 context = { u'order' : order } context . update ( order . details_as_dict ( ) ) context . update ( ( extra_context or { } ) ) if ( HAS_PDF and ( request . GET . get ( u'format' ) == u'pdf' ) ) : response = HttpResponse ( content_type = u'application/pdf' ) name = slugify ( ( u'%s-invoice-%s' % ( settings . SITE_TITLE , order . id ) ) ) response [ u'Content-Disposition' ] = ( u'attachment; filename=%s.pdf' % name ) html = get_template ( template_pdf ) . render ( context ) pisa . CreatePDF ( html , response ) return response return TemplateResponse ( request , template , context )
display a plain text invoice for the given order .