Commit 9f6e3416063cdcbb6195745be7b71dfe96c4a448

Sweet store is now timestamp aware

  - adding timestamp validation and display in UI
  - removed the interface to add posts manually
swtr.py
(8 / 4)
  
3737
3838def validateSweet(payload):
3939 for i in payload:
40 if len(i['who']) and len(i['what']) and len(i['where']) and len(i['how']):
41 pass
42 else:
40 try:
41 if len(i['who']) and len(i['what']) and len(i['where']) and\
42 len(i['how']) and len(i['created']):
43 pass
44 else:
45 return False
46 except KeyError:
4347 return False
44 return True
48 return True
4549
4650@app.before_request
4751def init_db():
  
1111 <div class="page">
1212 <h1>SWeeT Store</h1>
1313 <div class=metanav>
14 <a href="{{ url_for('show_entries') }}"> Home </a> |
1415 {% if not session.logged_in %}
1516 <a href="{{ url_for('login') }}">Log In</a>
1617 {% else %}
18 <a href="{{ url_for('user') }}"> Users </a> |
1719 <a href="{{ url_for('serveUser') }}">Add User</a> |
1820 <a href="{{ url_for('logout') }}">Log Out</a>
1921 {% endif %}
  
11{% extends "layout.html" %}
22{% block body %}
3 {% if session.logged_in %}
4 <form action="{{ url_for('add_entry') }}" method="POST" class="add-entry">
5 <dl>
6 <dt>Who:</dt>
7 <dd><input type="text" name="who"></dd>
8 <dt>What:</dt>
9 <dd><input type="text" size="30" name="what"></dd>
10 <dt>Where:</dt>
11 <dd><input type="text" size="30" name="where"></dd>
12 <dt>How:</dt>
13 <dd><textarea name="how" rows="6" cols="40"></textarea></dd>
14 <dd><input type="submit" value=" Share "></dd>
15 </dl>
16 </form>
17 {% endif %}
183 <ul class="entries">
194 {% if entries|len > 0 %}
205 {% for entry in entries %}
216 <li>
227 @<b>{{ entry.who }}</b>
238 <b>#{{ entry.what }}</b> /{{ entry.where }} {{ entry.how|safe }}
9 {% if entry.created|len > 0 %}
10 <span><small>created: {{entry.created }}</small></span>
11 {% endif %}
2412 <a class="pull-right" href={{ "/posts/" + entry.id }}>
2513 <i class="icon-share-alt"></i>
2614 </a>