Deleting unused code
This commit is contained in:
parent
bf855e0a21
commit
179314cd86
@ -24,10 +24,6 @@ shots = Blueprint('shots', __name__)
|
||||
def index():
|
||||
shots = []
|
||||
|
||||
for n in Node.query.all():
|
||||
for p in n.properties:
|
||||
print p.value
|
||||
|
||||
for shot in Node.query.\
|
||||
join(NodeType).\
|
||||
filter(NodeType.url == 'shot'):
|
||||
@ -80,101 +76,6 @@ def add():
|
||||
return render_template('shots/add.html', form=form)
|
||||
|
||||
|
||||
|
||||
@shots.route("/procedural", methods=('GET', 'POST'))
|
||||
def procedural():
|
||||
from flask_wtf import Form
|
||||
from wtforms import TextField
|
||||
from wtforms import BooleanField
|
||||
from wtforms import SelectField
|
||||
from wtforms import TextAreaField
|
||||
from wtforms import IntegerField
|
||||
from wtforms import HiddenField
|
||||
|
||||
from application.modules.nodes.models import CustomFields
|
||||
from wtforms.validators import DataRequired
|
||||
|
||||
node_type = NodeType.query.filter_by(url='shot').first()
|
||||
class ProceduralForm(Form):
|
||||
pass
|
||||
|
||||
setattr(ProceduralForm,
|
||||
'name',
|
||||
TextField('Node Name', validators=[DataRequired()]))
|
||||
setattr(ProceduralForm,
|
||||
'description',
|
||||
TextAreaField('Description', validators=[DataRequired()]))
|
||||
setattr(ProceduralForm,
|
||||
'node_type_id',
|
||||
HiddenField(default=node_type.id))
|
||||
|
||||
for custom_field in CustomFields.query\
|
||||
.join(NodeType)\
|
||||
.filter(NodeType.url == 'shot'):
|
||||
|
||||
if custom_field.field_type == 'text':
|
||||
field_properties = TextAreaField(custom_field.name,
|
||||
validators=[DataRequired()])
|
||||
elif custom_field.field_type == 'integer':
|
||||
field_properties = IntegerField(custom_field.name,
|
||||
validators=[DataRequired()])
|
||||
elif custom_field.field_type == 'select':
|
||||
options = Node.query\
|
||||
.join(NodeType)\
|
||||
.filter(NodeType.url==custom_field.name_url)\
|
||||
.all()
|
||||
print options
|
||||
field_properties = SelectField(custom_field.name,
|
||||
coerce=int,
|
||||
choices=[(option.id, option.name) for option in options] )
|
||||
#choices=[(status.id, status.name) for status in statuses])
|
||||
|
||||
setattr(ProceduralForm, custom_field.name_url, field_properties)
|
||||
|
||||
form = ProceduralForm()
|
||||
|
||||
if form.validate_on_submit():
|
||||
node = Node(
|
||||
name=form.name.data,
|
||||
description=form.description.data,
|
||||
node_type_id=form.node_type_id.data)
|
||||
db.session.add(node)
|
||||
db.session.commit()
|
||||
|
||||
for custom_field in CustomFields.query\
|
||||
.join(NodeType)\
|
||||
.filter(NodeType.url == 'shot'):
|
||||
|
||||
for field in form:
|
||||
if field.name == custom_field.name_url:
|
||||
node_property = NodeProperties(
|
||||
node_id=node.id,
|
||||
custom_field_id=custom_field.id,
|
||||
value=field.data)
|
||||
db.session.add(node_property)
|
||||
db.session.commit()
|
||||
|
||||
return redirect('/')
|
||||
else:
|
||||
print form.errors
|
||||
# if form.validate_on_submit():
|
||||
# shot_type = NodeType.query.filter_by(url='shot').first()
|
||||
# shot = Node(
|
||||
# name=form.name.data,
|
||||
# description=form.description.data,
|
||||
# node_type_id=shot_type.id,
|
||||
# status_id=form.status_id.data)
|
||||
# # Create entry in the attached node table
|
||||
# shot.node_shot = [NodeShot(
|
||||
# duration=form.duration.data,
|
||||
# notes=form.notes.data)]
|
||||
|
||||
# db.session.add(shot)
|
||||
# db.session.commit()
|
||||
# return redirect('/')
|
||||
return render_template('shots/procedural.html', form=form)
|
||||
|
||||
|
||||
@shots.route("/edit/<int:shot_id>", methods=('GET', 'POST'))
|
||||
def edit(shot_id):
|
||||
shot = Node.query.get(shot_id)
|
||||
@ -186,7 +87,6 @@ def edit(shot_id):
|
||||
note=shot.node_shot[0].notes)
|
||||
|
||||
if form.validate_on_submit():
|
||||
print shot.node_shot
|
||||
shot.name = form.name.data
|
||||
shot.description = form.description.data
|
||||
shot.node_shot[0].duration = form.duration.data
|
||||
|
Loading…
x
Reference in New Issue
Block a user