This file looks large and may slow your browser down if we attempt
to syntax highlight it, so we are showing it without any
pretty colors.
Highlight
it anyway.
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 |
|
8 |
from swtstore.classes.models import Context, Sweet, User |
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) |
24 |
return render_template('sweet/specific.html', sweet=sweet) |
25 |
else: |
26 |
abort(404) |