Added event items to the event form.

Need to get this working, thinking probably best to serialize the data and submit it that way so changes are only saved on update
This commit is contained in:
Tom Price
2014-12-03 12:13:13 +00:00
parent 1368224be6
commit 5cf73d441c
5 changed files with 17 additions and 5 deletions

View File

@@ -10,6 +10,7 @@ class EventForm(forms.ModelForm):
meet_at = forms.DateTimeField(input_formats=datetime_input_formats, required=False)
access_at = forms.DateTimeField(input_formats=datetime_input_formats, required=False)
name = forms.CharField(min_length=3)
class Meta:
model = models.Event
fields = ['is_rig', 'name', 'venue', 'start_date', 'start_time', 'end_date',

View File

@@ -294,7 +294,6 @@
value="{{ object.mic.name|default_if_none:"" }}"/>
</div>
</div>
{#% include 'RIGS/eventitem_table.html' %#}
</div>
<div class="col-sm-12">
<div class="pull-right">
@@ -307,6 +306,18 @@
</div>
</div>
</div>
<!-- /.col-md-6 -->
<div class="col-sm-12">
<div class="panel panel-default form-hws form-is_rig {% if object.pk and not object.is_rig %}hidden{% endif %}">
<div class="panel-body">
<div class="form-group">
<label for="{{ form.notes.id_for_label }}">{{ form.notes.label }}</label>
{% render_field form.notes class+="form-control" %}
</div>
{% include "RIGS/item_table.html" %}
</div>
</div>
</div>
</form>
<div class="modal fade" id="itemModal" role="dialog" aria-labelledby="itemModal" aria-hidded="true">
<div class="modal-dialog">

View File

@@ -1,4 +1,4 @@
<tr id="item-{{item.pk}}" data-url="{#% url item_row item.pk %#}" data-pk="{{item.pk}}">
<tr id="item-{{item.pk}}" data-url="{% url 'api_secure' item.pk %}" data-pk="{{item.pk}}">
<td>
{{ item.name }}
{% if item.description %}
@@ -9,7 +9,7 @@
<td>£&nbsp;{{item.cost}}</td>
<td>{{item.quantity}}</td>
<td class="sub-total" data-subtotal="{{item.total_cost}}">£&nbsp;{{item.total_cost}}</td>
{% if response.edit %}
{% if edit %}
<td class="vert-align text-right">
<button type="button" class="item-edit btn btn-xs btn-default"
data-pk="{{item.pk}}"

View File

@@ -1,12 +1,12 @@
<div class="panel">
<table class="table table-hover" id="item-table">
<table class="table table-hover" id="item-table" {% if edit %}data-orderurl="{#% url 'item_order' %#}"{% endif %}>
<thead>
<tr>
<td>Item</td>
<td>Price</td>
<td>Quantity</td>
<td>Sub-total</td>
{% if response.edit %}
{% if edit %}
<td class="text-right">
<button type="button" class="btn btn-default btn-xs item-add"
data-url="{#% url eventitem_add object.pk %#}" data-toggle="modal"

Binary file not shown.