Merge pull request 'exploring_views' (#1) from exploring_views into main
Reviewed-on: OneTeam/don_confiao#1
This commit is contained in:
commit
764d3d8d85
@ -0,0 +1,6 @@
|
||||
<h1>Tienda la Ilusión</h1>
|
||||
<h2>Don Confiao</h2>
|
||||
<ul>
|
||||
<li><a href='./comprar'>Comprar</a></li>
|
||||
<li><a href='./compras'>Compras</a></li>
|
||||
</ul>
|
@ -0,0 +1,9 @@
|
||||
{% if purchases %}
|
||||
<ul>
|
||||
{% for purchase in purchases %}
|
||||
<li><a href="/don_confiao/{{ purchase.id }}/">{{ purchase.date }}, {{ purchase.customer }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<p>No hay Compras</p>
|
||||
{% endif %}
|
9
tienda_ilusion/don_confiao/urls.py
Normal file
9
tienda_ilusion/don_confiao/urls.py
Normal file
@ -0,0 +1,9 @@
|
||||
from django.urls import path
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path("", views.index, name="wellcome"),
|
||||
path("comprar", views.buy, name="buy"),
|
||||
path("compras", views.purchases, name="purchases"),
|
||||
]
|
@ -1,3 +1,18 @@
|
||||
from django.shortcuts import render
|
||||
from django.http import HttpResponse
|
||||
from django.template import loader
|
||||
|
||||
# Create your views here.
|
||||
from .models import Sale
|
||||
|
||||
def index(request):
|
||||
return render(request, 'don_confiao/index.html')
|
||||
|
||||
def buy(request):
|
||||
return HttpResponse("Nombre: ....")
|
||||
|
||||
def purchases(request):
|
||||
purchases = Sale.objects.all()
|
||||
context = {
|
||||
"purchases": purchases,
|
||||
}
|
||||
return render(request, 'don_confiao/purchases.html', context)
|
||||
|
@ -15,8 +15,9 @@ Including another URLconf
|
||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||
"""
|
||||
from django.contrib import admin
|
||||
from django.urls import path
|
||||
from django.urls import include, path
|
||||
|
||||
urlpatterns = [
|
||||
path("don_confiao/", include("don_confiao.urls")),
|
||||
path('admin/', admin.site.urls),
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user