Skip to content

Commit

Permalink
Merge pull request #4 from javlintor/refactor-frontend
Browse files Browse the repository at this point in the history
Refactor frontend
  • Loading branch information
javlintor authored Aug 16, 2024
2 parents 15d3741 + e734d00 commit 4e9b16b
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 110 deletions.

This file was deleted.

30 changes: 0 additions & 30 deletions manolibakes/core/management/commands/insert_from_sqlite.py

This file was deleted.

23 changes: 1 addition & 22 deletions manolibakes/core/management/commands/insert_orders.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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. "
Expand Down Expand Up @@ -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,
Expand Down
23 changes: 0 additions & 23 deletions manolibakes/core/management/commands/insert_weekly_defaults.py

This file was deleted.

10 changes: 3 additions & 7 deletions manolibakes/core/static/core/style.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
body {
font-size: min(3vw, 22px);
}

.header-title {
font-family: 'Young Serif', serif;
Expand All @@ -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;
}

Expand All @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions manolibakes/core/templates/core/_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% load static %}

<!DOCTYPE html>
<html lang="es">
<html lang="es" data-theme="dark">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
Expand Down Expand Up @@ -35,7 +35,7 @@
<a href="{% url 'members:login' %}" class="header-element underline" style="color: #bbb">Login</a>
{% endif %}
</header>
<main class="container" style="margin-top: 5vh; width: max(600px, 70vw)">
<main class="container">
{% block content %}

{% endblock %}
Expand Down
4 changes: 2 additions & 2 deletions manolibakes/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@

def get_dates(date_str: str | None = None) -> dict:
if date_str is None:
date = datetime.date.today()
date = datetime.date.today() + datetime.timedelta(days=1)
else:
try:
date = datetime.date.fromisoformat(date_str)
except ValueError:
logging.info("Incorrent date format.")
date = datetime.date.today()
date = datetime.date.today() + datetime.timedelta(days=1)
date_long_str = date.strftime("%A, %d de %B de %Y")
date_iso_str = date.strftime("%Y-%m-%d")
return {
Expand Down
4 changes: 0 additions & 4 deletions manolibakes/members/static/members/style.css
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
.form-field {
width: 20rem;
height: 1rem;
}
4 changes: 2 additions & 2 deletions manolibakes/members/templates/authenticate/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


{% block content %}
<main class='container' style="width: min(90vw, 500px); margin-top: 10vh">
<main class='container'>
<form action="{% url 'members:login' %}" method="post">
{% csrf_token %}
<h1>Bienvenido</h1>
Expand All @@ -22,7 +22,7 @@ <h1>Bienvenido</h1>
{{ form.non_field_errors }}
{% endif %}

<input type="submit" value="Log in" style="min-width: 15vw">
<input type="submit" value="Log in">
</form>
</main>
{% endblock %}

0 comments on commit 4e9b16b

Please sign in to comment.