Add Order Form

- created AddOrder static form
- created addorder view
- added stuff to urls.py
- created addorder.html
- connected add order button and addorder.html
parent 3264ae33
......@@ -59,7 +59,7 @@ ROOT_URLCONF = 'blizzardblast.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR)],
'DIRS': [os.path.join(BASE_DIR), 'templates'],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
......@@ -91,6 +91,7 @@ DATABASES = {
}
# Password validation
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
......
{% extends 'blizzardblast\templates\base.html' %}
{% load static %}
{% block title %}Add order{% endblock %}
{% block styles %}
{% endblock %}
{% block content %}
<form action="/addorder" method="post" style="text-align:center">
{% csrf_token %}
{{form}}
<input type="submit" value="Submit">
</form>
{% endblock %}
\ No newline at end of file
......@@ -22,7 +22,7 @@
</div>
<div id="CRUD-features">
<button class="crud-button">Add Order</button>
<button class="crud-button"><a href="{% url 'addorder' %}">Add Order</a></button>
<button class="crud-button">Delete Order</button>
<button class="crud-button">Refresh</button>
</div>
......
from django import forms
class AddOrderForm(forms.Form):
customer_no = forms.IntegerField(label='Customer no')
customer_name = forms.CharField(label='Customer Name', max_length=50)
date = forms.DateField(label='Date')
base_recipe = forms.CharField(label='Base Recipe')
add_on_qty = forms.IntegerField(label='Add-on Qty')
add_on_name = forms.CharField(label='Add-on')
\ No newline at end of file
......@@ -8,4 +8,6 @@ urlpatterns = [
path('schedule', schedule, name='schedule'),
path('report', report, name='report'),
path('receipt', receipt, name='receipt'),
path('addorder', addorder, name='addorder' ),
]
from django.shortcuts import render
from django.http import HttpResponse
from .forms import AddOrderForm
def homepage(request):
return render(request, "blizzardblast/templates/index.html")
......@@ -19,3 +21,7 @@ def schedule(request):
def report(request):
return render(request, "blizzardblast/templates/report.html")
def addorder(request):
form = AddOrderForm()
return render(request, "blizzardblast/templates/addorder.html", {'form': form})
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment