Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Url problems fixed and templates created (project reorganized) #30

Merged
merged 1 commit into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified test1/accounts/__pycache__/urls.cpython-312.pyc
Binary file not shown.
Binary file modified test1/accounts/__pycache__/views.cpython-312.pyc
Binary file not shown.
Binary file modified test1/app/__pycache__/admin.cpython-312.pyc
Binary file not shown.
Binary file modified test1/app/__pycache__/forms.cpython-312.pyc
Binary file not shown.
Binary file modified test1/app/__pycache__/urls.cpython-312.pyc
Binary file not shown.
Binary file modified test1/app/__pycache__/views.cpython-312.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion test1/app/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class DishAdmin(admin.ModelAdmin):
# en aquesta classe li podem indicar quins valors podem veure al superuser quan veiem cada objecte
list_display = ['id','name', 'ingredients','meal']
list_display = ['id','name', 'ingredients','meal','grams']
#metode per a buscar o fer quaerys
search_fields=("name","ingredients")
#metode per a filtrar, basicament te pose al usuari el panel a la dreta per filtrar
Expand Down
Binary file not shown.
Binary file not shown.
17 changes: 0 additions & 17 deletions test1/app/templates/home/aboutUs.html

This file was deleted.

50 changes: 0 additions & 50 deletions test1/app/templates/home/barra_de_navegacion.html

This file was deleted.

10 changes: 6 additions & 4 deletions test1/app/templates/home/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
<p class="h1">del día a día</p>
</div>
</div>
<div class="position-absolute bottom-0 start-0 p-3">
<a href="{% url 'seleccionar_dia' %}" class="btn btn-success">Consulta tus estadísticas</a>
</div>

{% if user.is_authenticated %}
<div class="position-absolute bottom-0 start-0 p-3">
<a href="{% url 'seleccionar_dia' %}" class="btn btn-success">Consulta tus estadísticas</a>
</div>
{% endif %}

{% endblock %}

10 changes: 6 additions & 4 deletions test1/app/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
from . import views
from .views import *


urlpatterns = [
# path('students/', get_students),
path('', home_noacc),
path('home/', home),
path('seleccionar-dia/',seleccionar_dia, name='seleccionar_dia'),

path('', home, name="home"),
path('home/', home, name="home"),
path('aboutUs/', aboutUs, name='aboutUs'),
path('contacto/', contacto, name='contacto'),
path('seleccionar-dia/', seleccionar_dia, name='seleccionar_dia'),

]
20 changes: 7 additions & 13 deletions test1/app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,7 @@
# return JsonResponse(student_values, safe=False)

def home(request): # cuan ya esta fet login o singup
return render(request, 'home/home.html', name='home')


def home_noacc(request):
return render(request, 'menu.html')


from datetime import datetime, timedelta
from django.shortcuts import render, get_object_or_404, redirect
from django.urls import reverse
from .models import Dish
from .forms import DishForm
return render(request, 'home/home.html')

def seleccionar_dia(request):
date_param = request.GET.get('date')
Expand Down Expand Up @@ -75,4 +64,9 @@ def seleccionar_dia(request):
'previous_date': previous_date,
'next_date': next_date,
'platos': platos,
})
})

def aboutUs(request):
return render(request, 'aboutUs.html')
def contacto(request):
return render(request, 'contacto.html')
Binary file modified test1/db.sqlite3
Binary file not shown.
Empty file removed test1/static/home/styleAboutUs.css
Empty file.
2 changes: 1 addition & 1 deletion test1/static/home/styleBarra.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@
.supersuperfuturistic-button .text-visible {
position: relative;
z-index: 2;
}
}
23 changes: 23 additions & 0 deletions test1/templates/aboutUs.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{% extends "base.html" %}
{% load static %}
{% block title %} Contacto {% endblock %}
{% block footer %}


<body style="background-image: url('{% static 'assets/alimentos.jpg' %}'); background-size: cover;">
<div class="container" style="padding-top: 50px;">
<div class="row">
<div class="col-md-8 offset-md-2">
<div class="card">
<div class="card-body">
<h2 class="card-title">About Us</h2>
<p class="card-text">Verde Bendito surge de la idea de 4 jovenes ambiciosos licienciados en
Nutrición con ganas de mostrar a la gente los macronutrientes de los alimenots que se consumen
en el día a día.</p>
</div>
</div>
</div>
</div>
</div>

{% endblock %}
2 changes: 1 addition & 1 deletion test1/templates/autentication.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{% block content %}
<div class="container-fluid">
<div class="row justify-content-center align-items-center" style="height: 100vh;">
<div class="col-lg-3 col-md-5 col-sm-7"> <!-- Ajuste de tamaño de la columna -->
<div class="col-lg-3 col-md-5 col-sm-7">
<div class="card border rounded shadow">
<div class="card-body p-4">
<img src="{% static 'assets/logo.png' %}" alt="logo" class="img-fluid mx-auto d-block mb-4">
Expand Down
31 changes: 18 additions & 13 deletions test1/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

{% block styles %}
<link rel="stylesheet" href="{% static 'home/styleBarra.css' %}">

{% endblock %}
</head>
<body>
Expand All @@ -30,22 +29,22 @@

<div id="content">
{% block content %}
<div class="nav nav-pills">
<div class="nav nav-pills" style="background-color: white;">
<div>
<img src="{% static 'assets/logoGreen.png' %}" alt="logo">
</div>

<div class="pestanyes">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="aboutUs.html">About Us</a>
</li>
<li class="nav-item">
<a class="nav-link" href="">Contact</a>
</li>
</div>
<div class="pestanyes">
<li class="nav-item">
<a class="nav-link {% if request.path == '/home/' or request.path == '/' %}active{% endif %}" href="/home">Home</a>
</li>
<li class="nav-item">
<a class="nav-link {% if request.path == '/aboutUs/' %}active{% endif %}" href="/aboutUs">About Us</a>
</li>
<li class="nav-item">
<a class="nav-link {% if request.path == '/contacto/' %}active{% endif %}" href="/contacto">Contact</a>
</li>
</div>

{% if user.is_authenticated %}
<div class="supersuperfuturistic-button">
Expand All @@ -56,6 +55,12 @@
</button>
</form>
</div>
{% else %}
<div class="supersuperfuturistic-button">
<a href="{% url 'autentication' %}" class="btn btn-futuristic btn-sm rounded-pill">
<span class="text-visible"> Log In</span>
</a>
</div>
{% endif %}
{% endblock %}
</div>
Expand Down
Loading