NodeType editing
This commit is contained in:
@@ -13,7 +13,7 @@ from sqlalchemy.orm import aliased
|
||||
from application import db
|
||||
|
||||
from application.modules.shots.forms import ShotForm
|
||||
from application.modules.nodes.models import Node, NodeType, Status
|
||||
from application.modules.nodes.models import Node, NodeType
|
||||
from application.modules.shots.models import NodeShot
|
||||
|
||||
|
||||
@@ -56,8 +56,7 @@ def view(shot_id):
|
||||
@shots.route("/create", methods=('GET', 'POST'))
|
||||
def create():
|
||||
form = ShotForm()
|
||||
# Populate dropdown select with available Statuses
|
||||
form.status_id.choices = [(status.id, status.name) for status in Status.query.all()]
|
||||
|
||||
if form.validate_on_submit():
|
||||
shot_type = NodeType.query.filter_by(url='shot').first()
|
||||
shot = Node(
|
||||
@@ -85,7 +84,7 @@ def edit(shot_id):
|
||||
description=shot.description,
|
||||
duration=shot.node_shot[0].duration,
|
||||
note=shot.node_shot[0].notes)
|
||||
form.status_id.choices = [(status.id, status.name) for status in Status.query.all()]
|
||||
#form.status_id.choices = [(status.id, status.name) for status in Status.query.all()]
|
||||
|
||||
if form.validate_on_submit():
|
||||
print shot.node_shot
|
||||
|
@@ -7,9 +7,18 @@ from wtforms import IntegerField
|
||||
|
||||
from wtforms.validators import DataRequired
|
||||
|
||||
from application.modules.nodes.models import Node, NodeType
|
||||
|
||||
class ShotForm(Form):
|
||||
statuses = Node.query\
|
||||
.join(NodeType)\
|
||||
.filter(NodeType.url == 'shot_status')\
|
||||
.all()
|
||||
|
||||
name = TextField('Shot Name', validators=[DataRequired()])
|
||||
description = TextAreaField('Description', validators=[DataRequired()])
|
||||
status_id = SelectField('Status', coerce=int)
|
||||
status_id = SelectField('Status',
|
||||
coerce=int,
|
||||
choices=[(status.id, status.name) for status in statuses])
|
||||
duration = IntegerField('Duration')
|
||||
notes = TextAreaField('Notes')
|
||||
|
Reference in New Issue
Block a user