Shot creation and editing
This commit is contained in:
parent
e42fb2ebc0
commit
08f95dcb99
@ -34,6 +34,7 @@ def index():
|
|||||||
shots.append(dict(
|
shots.append(dict(
|
||||||
id=shot.id,
|
id=shot.id,
|
||||||
name=shot.name,
|
name=shot.name,
|
||||||
|
description=shot.description,
|
||||||
status=status))
|
status=status))
|
||||||
return render_template('shots/index.html',
|
return render_template('shots/index.html',
|
||||||
title='shots',
|
title='shots',
|
||||||
@ -50,13 +51,48 @@ def view(shot_id):
|
|||||||
else:
|
else:
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
"""
|
|
||||||
class ShotForm(Form):
|
class ShotForm(Form):
|
||||||
name = TextField('Blender-ID')
|
name = TextField('Shot Name', validators=[DataRequired()])
|
||||||
description = TextField('First Name', validators=[DataRequired()])
|
description = TextField('Description', validators=[DataRequired()])
|
||||||
parent_id = IntegerFiled('Last Name', validators=[DataRequired()])
|
|
||||||
cloud_communications = BooleanField('Cloud Communications')
|
@shots.route("/create", methods=('GET', 'POST'))
|
||||||
"""
|
|
||||||
@shots.route("/create")
|
|
||||||
def create():
|
def create():
|
||||||
return 'create here'
|
form = ShotForm()
|
||||||
|
if form.validate_on_submit():
|
||||||
|
shot_type = NodeType.query.filter_by(name='shot').first()
|
||||||
|
shot = Node(
|
||||||
|
name=form.name.data,
|
||||||
|
description=form.description.data,
|
||||||
|
node_type_id=shot_type.id)
|
||||||
|
db.session.add(shot)
|
||||||
|
db.session.commit()
|
||||||
|
return redirect('/')
|
||||||
|
return render_template('shots/create.html', form=form)
|
||||||
|
|
||||||
|
|
||||||
|
@shots.route("/edit/<int:shot_id>", methods=('GET', 'POST'))
|
||||||
|
def edit(shot_id):
|
||||||
|
shot = Node.query.get(shot_id)
|
||||||
|
form = ShotForm(
|
||||||
|
name=shot.name,
|
||||||
|
description=shot.description)
|
||||||
|
if form.validate_on_submit():
|
||||||
|
shot.name = form.name.data
|
||||||
|
shot.description=form.description.data
|
||||||
|
db.session.commit()
|
||||||
|
return redirect('/')
|
||||||
|
return render_template(
|
||||||
|
'shots/edit.html',
|
||||||
|
form=form,
|
||||||
|
shot_id=shot_id)
|
||||||
|
|
||||||
|
|
||||||
|
@shots.route("/delete/<int:shot_id>")
|
||||||
|
def delete(shot_id):
|
||||||
|
shot = Node.query.get(shot_id)
|
||||||
|
if shot:
|
||||||
|
db.session.delete(shot)
|
||||||
|
return redirect('/')
|
||||||
|
else:
|
||||||
|
abort(404)
|
||||||
|
23
attract/application/templates/shots/create.html
Normal file
23
attract/application/templates/shots/create.html
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{% extends 'layout.html' %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<div class="col-md-9">
|
||||||
|
<h2>Create shot</h2>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<form method="POST" action="{{url_for('shots.create')}}">
|
||||||
|
{{ form.hidden_tag() }}
|
||||||
|
<div class="form-group">
|
||||||
|
{{ form.name.label }}
|
||||||
|
{{ form.name(size=20, class='form-control') }}
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
{{ form.description.label }}
|
||||||
|
{{ form.description(size=20, class='form-control') }}
|
||||||
|
</div>
|
||||||
|
<input class="btn btn-default" type="submit" value="Create Shot">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
23
attract/application/templates/shots/edit.html
Normal file
23
attract/application/templates/shots/edit.html
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{% extends 'layout.html' %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<div class="col-md-9">
|
||||||
|
<h2>Edit shot</h2>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<form method="POST" action="{{url_for('shots.edit', shot_id=shot_id)}}">
|
||||||
|
{{ form.hidden_tag() }}
|
||||||
|
<div class="form-group">
|
||||||
|
{{ form.name.label }}
|
||||||
|
{{ form.name(size=20, class='form-control') }}
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
{{ form.description.label }}
|
||||||
|
{{ form.description(size=20, class='form-control') }}
|
||||||
|
</div>
|
||||||
|
<input class="btn btn-default" type="submit" value="Edit Shot">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
@ -2,46 +2,54 @@
|
|||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped" id="shots">
|
<div class="row">
|
||||||
<thead>
|
<div class="col-md-12">
|
||||||
<tr>
|
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped" id="shots">
|
||||||
<th>Shot Name</th>
|
<thead>
|
||||||
<th>Description</th>
|
<tr>
|
||||||
<th>Duration</th>
|
<th>Shot Name</th>
|
||||||
<th>Status</th>
|
<th>Description</th>
|
||||||
<th>Tasks</th>
|
<th>Duration</th>
|
||||||
<th>Notes</th>
|
<th>Status</th>
|
||||||
<th width="8%"></th>
|
<th>Tasks</th>
|
||||||
</tr>
|
<th>Notes</th>
|
||||||
</thead>
|
<th width="8%"></th>
|
||||||
<tbody>
|
</tr>
|
||||||
{% for shot in shots %}
|
</thead>
|
||||||
<tr id="row_{{shot['id']}}">
|
<tbody>
|
||||||
<td><a href="{{url_for('shots.view', shot_id=shot['id'])}}">{{shot['name']}}</a></td>
|
{% for shot in shots %}
|
||||||
<td>{{shot['description']}}</td>
|
<tr id="row_{{shot['id']}}">
|
||||||
<td></td>
|
<td><a href="{{url_for('shots.view', shot_id=shot['id'])}}">{{shot['name']}}</a></td>
|
||||||
<td><span class="label label-default" style="background-color:<?php echo $shot['status_color'] ?>">{{shot['status']}}</span></td>
|
<td>{{shot['description']}}</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td><span class="label label-default" style="background-color:<?php echo $shot['status_color'] ?>">{{shot['status']}}</span></td>
|
||||||
<td>
|
<td></td>
|
||||||
<a class="btn btn-default btn-xs" href="/shots/edit/<?php echo $shot['shot_id'] ?>"><i class="glyphicon glyphicon-edit"></i> Edit</a>
|
<td></td>
|
||||||
</td>
|
<td>
|
||||||
</tr>
|
<a class="btn btn-default btn-xs" href="{{url_for('shots.edit', shot_id=shot['id'])}}"><i class="glyphicon glyphicon-edit"></i> Edit</a>
|
||||||
{% endfor %}
|
</td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
{% endfor %}
|
||||||
<tfoot>
|
|
||||||
<tr>
|
</tbody>
|
||||||
<th>Shot Name</th>
|
<tfoot>
|
||||||
<th>Description</th>
|
<tr>
|
||||||
<th>Duration</th>
|
<th>Shot Name</th>
|
||||||
<th>Status</th>
|
<th>Description</th>
|
||||||
<th>Tasks</th>
|
<th>Duration</th>
|
||||||
<th>Notes</th>
|
<th>Status</th>
|
||||||
<th></th>
|
<th>Tasks</th>
|
||||||
</tr>
|
<th>Notes</th>
|
||||||
</tfoot>
|
<th></th>
|
||||||
</table>
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<a href="{{url_for('shots.create')}}" class="btn btn-default">Create</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% endblock %}
|
||||||
{% endblock %}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user