Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class Order(Base):
product_quantity = Column('Product Quantity', Integer)
order_date = Column('Order Date', DateTime)
shipping_date = Column('Shipping Date', DateTime)
delivery_date = Column('Delivery Date', DateTime)


# define routes
# route to display orders
Expand Down Expand Up @@ -85,6 +87,8 @@ def add_order():
product_quantity = request.form.get('product_quantity')
order_date = request.form.get('order_date')
shipping_date = request.form.get('shipping_date')
delivery_date = request.form['delivery_date']


# Create a session to interact with the database
session = Session()
Expand All @@ -99,7 +103,10 @@ def add_order():
product_quantity=product_quantity,
order_date=order_date,
shipping_date=shipping_date
)
delivery_date=delivery_date
)



# Add the new order to the session and commit to the database
session.add(new_order)
Expand Down
5 changes: 5 additions & 0 deletions templates/orders.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ <h2 class="tab-title">Order List</h2>
<th>Product Quantity</th>
<th>Order Date</th>
<th>Shipping Date</th>
<th>Delivery Date</th>
</tr>
</thead>
<tbody>
Expand All @@ -40,6 +41,7 @@ <h2 class="tab-title">Order List</h2>
<td>{{ order.product_quantity }}</td>
<td>{{ order.order_date }}</td>
<td>{{ order.shipping_date }}</td>
<td>{{ order.delivery_date }}</td>
</tr>
{% endfor %}
</tbody>
Expand Down Expand Up @@ -74,6 +76,9 @@ <h2 class="tab-title">Add New Order</h2>
<label for="shipping_date">Shipping Date:</label>
<input type="text" id="shipping_date" name="shipping_date" required><br>
<input type="submit" value="Add Order">
<label for="delivery_date">Delivery Date:</label>
<input type="date" id="delivery_date" name="delivery_date"><br><br>
<input type="submit" value="Add Order">
</form>
</div>
</div>
Expand Down