|
|
@@ -329,37 +329,6 @@ def eliminar_cuenta(request, cuenta_id):
|
|
|
'tiene_movimientos': tiene_movimientos,
|
|
|
})
|
|
|
|
|
|
-
|
|
|
-@login_required
|
|
|
-def ver_cuenta(request, cuenta_id):
|
|
|
- hoy = date.today()
|
|
|
-
|
|
|
- cuenta = get_object_or_404(Cuenta, id=cuenta_id, usuario=request.user)
|
|
|
- movimientos = Movimiento.objects.filter(
|
|
|
- db_models.Q(cuenta_origen=cuenta) | db_models.Q(cuenta_destino=cuenta)
|
|
|
- )
|
|
|
-
|
|
|
- movimientos = movimientos.filter(fecha__year=hoy.year, fecha__month=hoy.month)
|
|
|
-
|
|
|
- form = FiltroCuentaForm(request.GET or None)
|
|
|
- if form.is_valid():
|
|
|
- mes = int(form.cleaned_data['mes'] or date.today().month)
|
|
|
- anio = int(form.cleaned_data['anio'] or date.today().year)
|
|
|
- categoria = form.cleaned_data.get('categoria')
|
|
|
-
|
|
|
- movimientos = movimientos.filter(fecha__month=mes, fecha__year=anio)
|
|
|
- if categoria:
|
|
|
- movimientos = movimientos.filter(categoria=categoria)
|
|
|
-
|
|
|
- movimientos = movimientos.order_by('-fecha')
|
|
|
-
|
|
|
- return render(request, 'ver_cuenta.html', {
|
|
|
- 'cuenta': cuenta,
|
|
|
- 'movimientos': movimientos,
|
|
|
- 'form': form
|
|
|
- })
|
|
|
-
|
|
|
-
|
|
|
# API
|
|
|
|
|
|
def api_datos_completos(request):
|