Commit 9f6e3416063cdcbb6195745be7b71dfe96c4a448
- Diff rendering mode:
- inline
- side by side
swtr.py
(8 / 4)
  | |||
37 | 37 | ||
38 | 38 | def validateSweet(payload): | |
39 | 39 | 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: | ||
43 | 47 | return False | |
44 | return True | ||
48 | return True | ||
45 | 49 | ||
46 | 50 | @app.before_request | |
47 | 51 | def init_db(): |
templates/layout.html
(2 / 0)
  | |||
11 | 11 | <div class="page"> | |
12 | 12 | <h1>SWeeT Store</h1> | |
13 | 13 | <div class=metanav> | |
14 | <a href="{{ url_for('show_entries') }}"> Home </a> | | ||
14 | 15 | {% if not session.logged_in %} | |
15 | 16 | <a href="{{ url_for('login') }}">Log In</a> | |
16 | 17 | {% else %} | |
18 | <a href="{{ url_for('user') }}"> Users </a> | | ||
17 | 19 | <a href="{{ url_for('serveUser') }}">Add User</a> | | |
18 | 20 | <a href="{{ url_for('logout') }}">Log Out</a> | |
19 | 21 | {% endif %} |
templates/show_entries.html
(3 / 15)
  | |||
1 | 1 | {% extends "layout.html" %} | |
2 | 2 | {% 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 %} | ||
18 | 3 | <ul class="entries"> | |
19 | 4 | {% if entries|len > 0 %} | |
20 | 5 | {% for entry in entries %} | |
21 | 6 | <li> | |
22 | 7 | @<b>{{ entry.who }}</b> | |
23 | 8 | <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 %} | ||
24 | 12 | <a class="pull-right" href={{ "/posts/" + entry.id }}> | |
25 | 13 | <i class="icon-share-alt"></i> | |
26 | 14 | </a> |