diff --git a/manolibakes/core/management/commands/insert_customers_from_sqlite.py b/manolibakes/core/management/commands/insert_customers_from_sqlite.py deleted file mode 100644 index 6aac45c..0000000 --- a/manolibakes/core/management/commands/insert_customers_from_sqlite.py +++ /dev/null @@ -1,18 +0,0 @@ -from django.core.management.base import BaseCommand -from core.models import Customer - -from sqlalchemy import create_engine -from sqlalchemy import text - -sqlite_engine = create_engine("sqlite+pysqlite:///manolibakes/db.sqlite3") - - -class Command(BaseCommand): - help = "Migrate data from sqlite to postgres" - - def handle(self, *args, **options): - query = text("SELECT * FROM core_customer") - with sqlite_engine.connect() as conn: - for customer in conn.execute(query): - customer_model = Customer(*customer) - customer_model.save() diff --git a/manolibakes/core/management/commands/insert_from_sqlite.py b/manolibakes/core/management/commands/insert_from_sqlite.py deleted file mode 100644 index e8c7f98..0000000 --- a/manolibakes/core/management/commands/insert_from_sqlite.py +++ /dev/null @@ -1,30 +0,0 @@ -from django.core.management.base import BaseCommand -import logging -from core.models import Bread, Customer - -from sqlalchemy import create_engine -from sqlalchemy import text - -sqlite_engine = create_engine("sqlite+pysqlite:///data/db.sqlite3") - - -class Command(BaseCommand): - help = "Migrate data from sqlite to postgres" - - def handle(self, *args, **options): - with sqlite_engine.connect() as conn: - try: - query = text("SELECT * FROM core_bread") - for bread in conn.execute(query): - bread_model = Bread(*bread) - bread_model.save() - except Exception as e: - logging.error(f"Something went wrong when inserting bread: {e}") - - try: - query = text("SELECT * FROM core_customer") - for customer in conn.execute(query): - customer_model = Customer(*customer) - customer_model.save() - except Exception as e: - logging.error(f"Something went wrong when inserting customers: {e}") diff --git a/manolibakes/core/management/commands/insert_orders.py b/manolibakes/core/management/commands/insert_orders.py index 067f0d3..39c8105 100644 --- a/manolibakes/core/management/commands/insert_orders.py +++ b/manolibakes/core/management/commands/insert_orders.py @@ -6,7 +6,7 @@ from pydantic import PositiveInt import datetime -from core.models import WeeklyDefaults, Order, Customer, Bread, DailyDefaults +from core.models import Order, Customer, Bread, DailyDefaults class CustomerQueryError(Exception): @@ -64,11 +64,6 @@ def add_arguments(self, parser): "If --customer-name is None, this argument is ignored." "If --customer-name is not None and --customer-lastname is, raise an exception", ) - parser.add_argument( - "--weekday", - help="Name of the weekday whose defualt order is going to be computed. " - "If None, all weekdays will be computed", - ) parser.add_argument( "--bread", help="Name of the bread whose defualt order is going to be computed. " @@ -98,23 +93,7 @@ def handle(self, *args, **options): for customer, bread, days_future in iterable: date = date_from + datetime.timedelta(days=days_future) logging.info(f"Inserting orders for date {date}...") - weekday = date.weekday() number = 0 - try: - weekly_default = WeeklyDefaults.objects.get( - customer=customer, bread=bread, weekday=weekday - ) - number += weekly_default.number - except WeeklyDefaults.DoesNotExist: - pass - try: - daily_default = DailyDefaults.objects.get( - customer=customer, - bread=bread, - ) - number += daily_default.number - except DailyDefaults.DoesNotExist: - pass order, _ = Order.objects.get_or_create( customer=customer, bread=bread, diff --git a/manolibakes/core/management/commands/insert_weekly_defaults.py b/manolibakes/core/management/commands/insert_weekly_defaults.py deleted file mode 100644 index 96dab3b..0000000 --- a/manolibakes/core/management/commands/insert_weekly_defaults.py +++ /dev/null @@ -1,23 +0,0 @@ -from django.core.management.base import BaseCommand -import random -from itertools import product - -from core.models import Customer, Bread, WeeklyDefaults - - -class Command(BaseCommand): - - def handle(self, *args, **options): - # get customers - customer = Customer.objects.get(pk=9) - # get breads - breads = Bread.objects.all() - breads = breads[:3] - for bread, weekday in product( - breads, WeeklyDefaults.Weekday.values - ): - number = random.randrange(1, 5) - weeklydefault = WeeklyDefaults( - customer=customer, bread=bread, weekday=weekday, number=number - ) - weeklydefault.save() diff --git a/manolibakes/core/static/core/style.css b/manolibakes/core/static/core/style.css index 48c063e..7eab0f2 100644 --- a/manolibakes/core/static/core/style.css +++ b/manolibakes/core/static/core/style.css @@ -1,6 +1,3 @@ -body { - font-size: min(3vw, 22px); -} .header-title { font-family: 'Young Serif', serif; @@ -12,8 +9,8 @@ body { display: flex; justify-content: space-between; align-items: center; - padding: 10px 40px; - /* background-color: rgb(23, 21, 36); */ + padding: 2vw 4vw; + gap: 10px; border-bottom: solid 0.5px white; } @@ -22,15 +19,14 @@ body { .customer-list-element, .bread-list-element { color: rgb(255, 255, 255); text-decoration: inherit; + font-size: 0.8rem; } .underline { text-decoration: none; - /* Ensures the link is not underlined by default */ position: relative; transition: all 0.3s ease; - /* Adjusts the transition speed and type */ } .underline:hover::after { diff --git a/manolibakes/core/templates/core/_base.html b/manolibakes/core/templates/core/_base.html index ef66b99..f98afac 100644 --- a/manolibakes/core/templates/core/_base.html +++ b/manolibakes/core/templates/core/_base.html @@ -3,7 +3,7 @@ {% load static %} - +
@@ -35,7 +35,7 @@ Login {% endif %} -