create views comandas

This commit is contained in:
2024-12-12 10:47:36 -03:00
parent ae5d47fa7c
commit 2f84ca97c3
20 changed files with 158 additions and 10 deletions

View File

@@ -1,12 +1,33 @@
{% extends "base.html" %}
{% load static %}
{% block 'title' %}
Type Pay
Comandas{% endblock %}
{% block 'head' %}
<link rel="stylesheet" href="{% static 'comandas/css/comandas.css' %}">
{% endblock %}
{% block 'body' %}
Body Type Pay
body>
<div class="grid-container">
{% for comanda in comandas %}
<div href="{% url 'viewcomanda' %}?parametro={{ comanda.id }}" class="card"> <a href="{% url 'viewcomanda' %}?parametro={{ comanda.id }}">{{comanda.name}} </a>
</div>
{% endfor %}
</div>
</body>
{% endblock %}

View File

@@ -0,0 +1,29 @@
{% extends "base.html" %}
{% load static %}
{% block 'title' %}
Comandas{% endblock %}
{% block 'head' %}
<link rel="stylesheet" href="{% static 'comandas/css/viewcomanda.css' %}">
{% endblock %}
{% block 'body' %}
body>
<div class="grid-container">
<h4>{{comanda.id}}</h4>
<h4>{{comanda.name}}</h4>
<h4>{{comanda.mesa}}</h4>
<h4>{{comanda.dt_open}}</h4>
</div>
</body>
{% endblock %}

View File

@@ -4,6 +4,7 @@ from . import views
urlpatterns = [
path('', views.comandas, name='comandas'),
path('viewcomanda/', views.viewComanda, name='viewcomanda'),

View File

@@ -1,6 +1,19 @@
from django.shortcuts import render
from django.shortcuts import render, redirect
from comandas.models import Comanda
# Create your views here.
def comandas(request):
return render(request, 'comandas.html')
comandas = Comanda.objects.all()
return render(request, 'comandas.html', {'comandas': comandas})
def viewComanda(request):
id = request.GET.get('parametro')
comanda_id = int(id)
comanda = Comanda.objects.get(id=comanda_id)
return render(request, 'viewcomanda.html', {'comanda': comanda})