Ejemplo n.º 1
0
def bezahlcode_view(request):
	if not settings.EVENT_BEZAHLCODE_ENABLE:
		return HttpResponseNotFound()

	preorders = CustomPreorder.objects.filter(user_id=request.user.pk)
	if len(preorders) < 1:
		return HttpResponseServerError()

	import pyqrcode
	uri = make_bezahlcode_uri(preorders[0].get_reference_hash(), \
			preorders[0].get_sale_amount()[0]['total'])
	buf = StringIO.StringIO()
	qr = pyqrcode.MakeQRImage(uri)
	img = qr.resize((200,200), Image.ANTIALIAS)
	img.save(buf, "PNG")
	return HttpResponse(buf.getvalue(), mimetype="image/png")
Ejemplo n.º 2
0
def tickets_view(request):
	nav = 'my'

	try:
		preorders = CustomPreorder.objects.filter(user_id=request.user.pk)
	except CustomPreorder.DoesNotExist:
		preorders = []

	if len(preorders) < 1:
		messages.error(request, _("You need to buy something first."))
		return redirect("default")

	if settings.EVENT_BEZAHLCODE_ENABLE and len(preorders) > 0:
		bezahlcode = make_bezahlcode_uri(preorders[0].get_reference_hash(), \
			preorders[0].get_sale_amount()[0]['total'])

	return render_to_response('tickets.html', locals(), context_instance=RequestContext(request))