Refactoring: shot forms in own file
This commit is contained in:
parent
971b37c4d2
commit
f987b317ec
@ -10,17 +10,9 @@ from flask.ext.thumbnails import Thumbnail
|
|||||||
from flask.ext.sqlalchemy import SQLAlchemy
|
from flask.ext.sqlalchemy import SQLAlchemy
|
||||||
from sqlalchemy.orm import aliased
|
from sqlalchemy.orm import aliased
|
||||||
|
|
||||||
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.validators import DataRequired
|
|
||||||
|
|
||||||
from application import db
|
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, Status
|
||||||
from application.modules.shots.models import NodeShot
|
from application.modules.shots.models import NodeShot
|
||||||
|
|
||||||
@ -61,14 +53,6 @@ def view(shot_id):
|
|||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
|
|
||||||
class ShotForm(Form):
|
|
||||||
name = TextField('Shot Name', validators=[DataRequired()])
|
|
||||||
description = TextAreaField('Description', validators=[DataRequired()])
|
|
||||||
status_id = SelectField('Status', coerce=int)
|
|
||||||
duration = IntegerField('Duration')
|
|
||||||
notes = TextAreaField('Notes')
|
|
||||||
|
|
||||||
|
|
||||||
@shots.route("/create", methods=('GET', 'POST'))
|
@shots.route("/create", methods=('GET', 'POST'))
|
||||||
def create():
|
def create():
|
||||||
form = ShotForm()
|
form = ShotForm()
|
||||||
|
15
attract/application/modules/shots/forms.py
Normal file
15
attract/application/modules/shots/forms.py
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
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.validators import DataRequired
|
||||||
|
|
||||||
|
class ShotForm(Form):
|
||||||
|
name = TextField('Shot Name', validators=[DataRequired()])
|
||||||
|
description = TextAreaField('Description', validators=[DataRequired()])
|
||||||
|
status_id = SelectField('Status', coerce=int)
|
||||||
|
duration = IntegerField('Duration')
|
||||||
|
notes = TextAreaField('Notes')
|
Loading…
x
Reference in New Issue
Block a user