Skip to content

Instantly share code, notes, and snippets.

/hello_get_value.tpl

Created Feb 17, 2013
Embed
What would you like to do?
Welcome page and grab trade id input.
<!DOCTYPE html>
<html>
<head>
<title>Hello</title>
</head>
<body>
<p>
Let's find trades! Yeah!
</p>
<form action="/enrich_display" method="POST">
What's your trade id? <input type="text" name="tradeId" size="25"><br>
<input type="submit" value="Go find it you!">
</form>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Trade Data</title>
<script>
function goBack()
{
window.history.back()
}
</script>
</head>
<body>
<p>Aaaaaand we're back.</p>
%if (trade is None):
<p>Unfortunately we know nothing about a trade id like {{criterium}}</p>
%else:
%try:
%if (trades.count() > 1):
<p>We have at least {{trades.count()}} matches on criterion {{criterium}}. Please refine your criterion to get closer to the one you want.</p>
<p>Matching trade ids:
<ul>
%for tradeid in trades:
<li>{{tradeid['Trade_Id']}}</li>
%end
</ul>
</p>
%end
<p>Here's the non-empty fields we have for the first match trade {{trade['Trade_Id']}} (or go <input type="button" value="back" onclick="goBack()">):</p>
<ul>
%for key in sorted(trade.iterkeys()):
%if (key != "_id" and trade[key] != ""):
%if (type(trade[key]) is int):
%try:
<li>{{key}} : int={{trade[key]}}, character={{chr(trade[key])}}</li>
%except:
<li>{{key}} : {{trade[key]}}</li>
%end
%else:
<li>{{key}} : {{trade[key]}}</li>
%end
%end
%end
</ul>
%except:
<p>It's all gone a bit pete tong. Contact support</p>
%end
%end
<p>That's it. Go <input type="button" value="home" onclick="goBack()">.</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.