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
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)
27
28