8fe0bbc by Anon Ray at 2014-05-10 |
1 |
# -*- coding utf-8 -*- |
|
2 |
# classes/views/sweet.py |
|
3 |
|
|
4 |
|
|
5 |
from flask import Module, jsonify, request, render_template, redirect,\ |
|
6 |
url_for, abort, json |
|
7 |
|
1e7645a by Anon Ray at 2014-06-03 |
8 |
from swtstore.classes.models import Context, Sweet, User |
8fe0bbc by Anon Ray at 2014-05-10 |
9 |
|
|
10 |
|
|
11 |
sweet = Module(__name__) |
|
12 |
|
|
13 |
@sweet.route('/<id>', methods=['GET']) |
|
14 |
def showSweet(id): |
|
15 |
#current_user = User.getCurrentUser() |
|
16 |
#if current_user is None: |
|
17 |
# return redirect(url_for('index')) |
|
18 |
|
|
19 |
#user = current_user.to_dict() |
|
20 |
print "recvd sweet id: %s" % (id) |
|
21 |
sweet = Sweet.query.get(id) |
|
22 |
if sweet: |
|
23 |
print "sweet found " + str(sweet) |
427df6d by Anon Ray at 2014-05-11 |
24 |
return render_template('sweet/specific.html', sweet=sweet) |
8fe0bbc by Anon Ray at 2014-05-10 |
25 |
else: |
|
26 |
abort(404) |
|
27 |
|
|
28 |
|