diff --git a/Finanzas/finanzas/apuntes/views.py b/Finanzas/finanzas/apuntes/views.py index 6553dc3..f89d51a 100644 --- a/Finanzas/finanzas/apuntes/views.py +++ b/Finanzas/finanzas/apuntes/views.py @@ -2,7 +2,7 @@ from django.contrib.auth.decorators import login_required from django.shortcuts import render, get_object_or_404, redirect # Create your views here. -from .models import Cuenta, Apunte +from .models import Cuenta, Apunte, Tipo from .forms import CuentaForm, ApunteForm @@ -11,7 +11,9 @@ def principal(request): cuentas = Cuenta.objects.all() apuntes = Apunte.objects.all() - return render(request, 'apuntes/index.html', {'cuentas': cuentas, 'apuntes': apuntes}) + tipos = Tipo.objects.prefetch_related('cuenta_set').all() + + return render(request, 'apuntes/index.html', {'tipos': tipos, 'cuentas': cuentas, 'apuntes': apuntes}) # Vistas para los cuentas diff --git a/Finanzas/finanzas/db.sqlite3 b/Finanzas/finanzas/db.sqlite3 index fcd35d6..6a30a37 100644 Binary files a/Finanzas/finanzas/db.sqlite3 and b/Finanzas/finanzas/db.sqlite3 differ diff --git a/Finanzas/finanzas/entornoPruebas.sh b/Finanzas/finanzas/entornoPruebas.sh index 61cd4df..4661050 100644 --- a/Finanzas/finanzas/entornoPruebas.sh +++ b/Finanzas/finanzas/entornoPruebas.sh @@ -1,6 +1,6 @@ export CSRF_TRUSTED_ORIGINS="http://localhost" export DEBUG="True" export SECRET_KEY="hola" -export DJANGO_ALLOWED_HOSTS="localhost" +export DJANGO_ALLOWED_HOSTS="localhost 127.0.0.1" diff --git a/Finanzas/finanzas/finanzas/urls.py b/Finanzas/finanzas/finanzas/urls.py index 1921888..33de4af 100644 --- a/Finanzas/finanzas/finanzas/urls.py +++ b/Finanzas/finanzas/finanzas/urls.py @@ -20,6 +20,8 @@ from django.conf.urls.static import static from django.conf import settings from django.views.generic.base import TemplateView # new +from apuntes import views + urlpatterns = [ path('obreros/', admin.site.urls), @@ -29,6 +31,7 @@ urlpatterns = [ path("accounts/", include("django.contrib.auth.urls")), - path("", TemplateView.as_view(template_name="apuntes/index.html"), - name="principal"), # new + path('', views.principal, name='principal'), + +# path("", TemplateView.as_view(template_name="apuntes/index.html"), name="principal"), # new ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) diff --git a/Finanzas/finanzas/templates/apuntes/detalle_cuenta.html b/Finanzas/finanzas/templates/apuntes/detalle_cuenta.html index 369d4bd..15ea476 100644 --- a/Finanzas/finanzas/templates/apuntes/detalle_cuenta.html +++ b/Finanzas/finanzas/templates/apuntes/detalle_cuenta.html @@ -9,7 +9,7 @@
| Cuenta | +Saldo | +
|---|---|
| {{ cuenta.nombre }} | +{{ cuenta.saldo_actual }} | +