Refactoring
This commit is contained in:
30
attract/application/modules/projects/__init__.py
Normal file
30
attract/application/modules/projects/__init__.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from flask import (abort,
|
||||
Blueprint,
|
||||
jsonify,
|
||||
render_template,
|
||||
redirect,
|
||||
request)
|
||||
|
||||
from flask.ext.thumbnails import Thumbnail
|
||||
from flask.ext.sqlalchemy import SQLAlchemy
|
||||
from sqlalchemy.orm import aliased
|
||||
|
||||
from application.modules.shots import Node
|
||||
from application.modules.shots import NodeType
|
||||
|
||||
# Name of the Blueprint
|
||||
projects = Blueprint('projects', __name__)
|
||||
|
||||
@projects.route("/")
|
||||
def index():
|
||||
projects = {}
|
||||
for project in Node.query.\
|
||||
join(NodeType).\
|
||||
filter(NodeType.url == 'project'):
|
||||
status = None
|
||||
if project.status:
|
||||
status = project.status.name
|
||||
projects[project.id] = dict(
|
||||
name=project.name,
|
||||
status=status)
|
||||
return jsonify(projects=projects)
|
Reference in New Issue
Block a user