Commit 709a019d authored by Felizia Tiburcio's avatar Felizia Tiburcio

make models

parent 77a6b16a
*.pyc
.env
*.sql
\ No newline at end of file
......@@ -42,6 +42,7 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'main'
]
MIDDLEWARE = [
......@@ -91,7 +92,6 @@ DATABASES = {
}
# Password validation
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
......
......@@ -75,7 +75,7 @@ ul {
/* ======= HEADING ======= */
header {
padding: 0.5rem;
animation: gradient 1s 1s infinite;
animation: gradient 5s 5s infinite;
color: #FEFCFD;
}
......
# Generated by Django 3.1.7 on 2021-12-12 06:02
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Employee',
fields=[
('employee_id', models.IntegerField(primary_key=True, serialize=False)),
('employee_name', models.CharField(max_length=255)),
],
options={
'db_table': 'employee',
'managed': False,
},
),
migrations.CreateModel(
name='Employeerole',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('role_date', models.DateField()),
('role_description', models.CharField(choices=[('Cashier', 'Cashier'), ('Preparation', 'Preparation'), ('Cleaning', 'Cleaning')], max_length=20)),
('is_manager', models.CharField(max_length=1)),
],
options={
'db_table': 'employeerole',
'managed': False,
},
),
]
# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
# * Rearrange models' order
# * Make sure each model has one field with primary_key=True
# * Make sure each ForeignKey and OneToOneField has `on_delete` set to the desired behavior
# * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table
# Feel free to rename the models, but don't rename db_table values or field names.
from django.db import models
# Create your models here.
class Employee(models.Model):
employee_id = models.IntegerField(primary_key=True)
employee_name = models.CharField(max_length=255)
class Meta:
managed = False
db_table = 'employee'
class EmployeeRole(models.Model):
ROLES = [
('Cashier', 'Cashier'),
('Preparation', 'Preparation'),
('Cleaning', 'Cleaning'),
]
role_date = models.DateField()
employee = models.ForeignKey(Employee, models.DO_NOTHING)
role_description = models.CharField(max_length=20, choices=ROLES)
is_manager = models.CharField(max_length=1)
class Meta:
managed = False
db_table = 'employeerole'
......@@ -2,26 +2,38 @@ from django.shortcuts import render
from django.http import HttpResponse
from .forms import AddOrderForm
from .models import *
def homepage(request):
return render(request, "blizzardblast/templates/index.html")
def order(request):
return render(request, "blizzardblast/templates/order.html")
def receipt(request):
return render(request, "blizzardblast/templates/receipt.html")
def inventory(request):
return render(request, "blizzardblast/templates/inventory.html")
def schedule(request):
for employee in Employee.objects.raw('SELECT * FROM employee'):
print(employee.employee_name)
for role in EmployeeRole.objects.all():
print(role.role_description)
return render(request, "blizzardblast/templates/schedule.html")
def report(request):
return render(request, "blizzardblast/templates/report.html")
def addorder(request):
form = AddOrderForm()
return render(request, "blizzardblast/templates/addorder.html", {'form': form})
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