First commit for a Flask-based Attract

This commit is contained in:
2014-04-20 12:09:16 +02:00
commit e42fb2ebc0
54 changed files with 5505 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
from application import app
from application.controllers.shots import index
@app.route("/")
def homepage():
"""Very minimal setup that returns the shot index view"""
return index()

View File

@@ -0,0 +1,31 @@
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.models.model import (
Node,
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)

View File

@@ -0,0 +1,62 @@
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 flask_wtf import Form
from wtforms import TextField, BooleanField
from wtforms.validators import DataRequired
from application import db
from application.models.model import (
Node,
NodeType)
# Name of the Blueprint
shots = Blueprint('shots', __name__)
@shots.route("/")
def index():
shots = []
for shot in Node.query.\
join(NodeType).\
filter(NodeType.url == 'shot'):
status = None
if shot.status:
status = shot.status.name
shots.append(dict(
id=shot.id,
name=shot.name,
status=status))
return render_template('shots/index.html',
title='shots',
shots=shots)
@shots.route("/view/<int:shot_id>")
def view(shot_id):
shot = Node.query.get(shot_id)
if shot and shot.node_type.url == 'shot':
return render_template('shots/view.html',
title='shots',
shot=shot)
else:
abort(404)
"""
class ShotForm(Form):
name = TextField('Blender-ID')
description = TextField('First Name', validators=[DataRequired()])
parent_id = IntegerFiled('Last Name', validators=[DataRequired()])
cloud_communications = BooleanField('Cloud Communications')
"""
@shots.route("/create")
def create():
return 'create here'