Commit 50b50f70 authored by Julia Santos's avatar Julia Santos

Setting up the App, models and view stuff etc

parent df0720f8
Pipeline #1315 failed with stages
from django.contrib import admin
from Bcrumbs.models import User, Product_Type, Item, Recipe
admin.site.register(User)
admin.site.register(Product_Type)
admin.site.register(Item)
admin.site.register(Recipe)
from django.apps import AppConfig
class BcrumbsConfig(AppConfig):
name = 'Bcrumbs'
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2021-03-15 09:47
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Item',
fields=[
('item_id', models.AutoField(primary_key=True, serialize=False)),
],
),
migrations.CreateModel(
name='Product_Type',
fields=[
('product_id', models.AutoField(primary_key=True, serialize=False)),
],
),
migrations.CreateModel(
name='Recipe',
fields=[
('recipe_id', models.AutoField(primary_key=True, serialize=False)),
],
),
migrations.CreateModel(
name='User',
fields=[
('user_id', models.AutoField(primary_key=True, serialize=False)),
],
),
]
from django.db import models
class User(models.Model):
user_id = models.AutoField(primary_key = True)
def __str__(self):
return str(self.user_id)
class Product_Type(models.Model):
product_id = models.AutoField(primary_key = True)
def __str__(self):
return str(self.product_id)
class Item(models.Model):
item_id = models.AutoField(primary_key = True)
def __str__(self):
return str(self.item_id)
class Recipe(models.Model):
recipe_id = models.AutoField(primary_key = True)
def __str__(self):
return str(self.recipe_id)
\ No newline at end of file
<html>
<head><title>Blue Mark - Customers</title>
{% load static %}
<link rel="stylesheet" href="{% static "header.css" %}">
</head>
<body>
{% block content %}
<div class="header">
<a href = 'http://127.0.0.1:8000/admin/'><h1>Blue mark</h1></a>
<a class="active" href="http://127.0.0.1:8000/home/"><h2>Delivery Requests</h2></a>
<a href="http://127.0.0.1:8000/rates"><h2>Rates</h2></a>
<a href="http://127.0.0.1:8000/reports"><h2>Reports</h2></a>
<a href="http://127.0.0.1:8000/customer"><h2>Customers</h2></a>
<a href="http://127.0.0.1:8000/item"><h2>Items</h2></a>
<a href="http://127.0.0.1:8000/staff"><h2>Staff</h2></a>
</div>
<div class="datab">
<table>
<tr><th colspan="9"><div class="table-name">CUSTOMERS</div></th></tr>
<tr>
<td><div class = "table-heads">ID</div></td>
<td><div class = "table-heads">First Name</div></td>
<td><div class = "table-heads">Last Name</div></td>
<td><div class = "table-heads">M.I.</div></td>
<td><div class = "table-heads">Phone No.</div></td>
<td><div class = "table-heads">City</div></td>
<td><div class = "table-heads">Street</div></td>
<td><div class = "table-heads">House No.</div></td>
<td><div class = "table-heads">Province</div></td>
</tr>
{% for customer in object_list %}
<tr>
<td><div class = "table-rows">{{customer.customer_id}}</div></td>
<td><div class = "table-rows">{{customer.customer_firstname}}</div></td>
<td><div class = "table-rows">{{customer.customer_lastname}}</div></td>
<td><div class = "table-rows">{{customer.customer_mi}}</div></td>
<td><div class = "table-rows">{{customer.phoneNo}}</div></td>
<td><div class = "table-rows">{{customer.city}}</div></td>
<td><div class = "table-rows">{{customer.street}}</div></td>
<td><div class = "table-rows">{{customer.houseNo}}</div></td>
<td><div class = "table-rows">{{customer.get_province_display}}</div></td>
</div>
</tr>
{% endfor %}
</table>
</div>
{% endblock %}
</body>
</html>
\ No newline at end of file
from django.test import TestCase
# Create your tests here.
from django.views.generic import ListView
from .models import User, Product_Type, Item, Recipe
from django.db.models import Q
class UserView(ListView):
model = User
template_name = 'customer.html'
def get_queryset(self)
return User.objects.all().order_by('user_id')
\ No newline at end of file
...@@ -37,6 +37,7 @@ INSTALLED_APPS = [ ...@@ -37,6 +37,7 @@ INSTALLED_APPS = [
'django.contrib.sessions', 'django.contrib.sessions',
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'Bcrumbs',
] ]
MIDDLEWARE = [ MIDDLEWARE = [
......
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