8fe0bbc by Anon Ray at 2014-05-10 1
# -*- coding utf-8 -*-
2
# classes/views/sweet.py
3
4
cffc26d by Anon Ray at 2014-06-10 5
from flask import Module, render_template, abort
8fe0bbc by Anon Ray at 2014-05-10 6
cffc26d by Anon Ray at 2014-06-10 7
from swtstore.classes.models import Sweet
8fe0bbc by Anon Ray at 2014-05-10 8
9
10
sweet = Module(__name__)
11
cffc26d by Anon Ray at 2014-06-10 12
d574b02 by Anon Ray at 2014-06-09 13
@sweet.route('/<int:id>', methods=['GET'])
8fe0bbc by Anon Ray at 2014-05-10 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)
48b7772 by Anon Ray at 2014-06-03 24
        return render_template('sweet/specific.html', sweet=sweet.to_dict())
8fe0bbc by Anon Ray at 2014-05-10 25
    else:
26
        abort(404)