Browse Source

Estilizando form de agregar cuenta

Celestino Rey 1 year ago
parent
commit
951e4d7552
4 changed files with 37 additions and 17 deletions
  1. 6 0
      finanzas/forms.py
  2. 4 0
      static/style.css
  3. 27 16
      templates/agregar_cuenta.html
  4. 0 1
      templates/dashboard.html

+ 6 - 0
finanzas/forms.py

@@ -21,3 +21,9 @@ class CuentaForm(forms.ModelForm):
     class Meta:
         model = Cuenta
         fields = ['nombre', 'tipo', 'saldo']
+
+        widgets = {
+            'nombre': forms.TextInput(attrs={'class': 'form-control'}),
+            'tipo': forms.Select(attrs={'class': 'form-control'}),
+            'saldo': forms.TextInput(attrs={'class': 'form-control'}),
+        }

+ 4 - 0
static/style.css

@@ -514,3 +514,7 @@ tbody tr td {
    cursor: pointer;
    font-size: 16px;
 }
+
+.div-form {
+   padding: 90px 0 0 0;
+}

+ 27 - 16
templates/agregar_cuenta.html

@@ -1,16 +1,27 @@
-<!DOCTYPE html>
-<html lang="es">
-<head>
-    <meta charset="UTF-8">
-    <title>Nueva Cuenta</title>
-</head>
-<body>
-    <h1>Crear Nueva Cuenta</h1>
-    <form method="post">
-        {% csrf_token %}
-        {{ form.as_p }}
-        <button type="submit">Guardar Cuenta</button>
-    </form>
-    <a href="{% url 'dashboard' %}">Volver al Dashboard</a>
-</body>
-</html>
+{% load i18n static %}
+
+{% include "_head.html" %}
+
+{% include "_menu.html" %}
+
+<section id="interface">
+    <div class="board">
+        {% include "_navigation.html" %}
+        <div class="div-form">
+            <h1>Crear Nueva Cuenta</h1>
+
+            <div class="form-group">
+                <form method="post">
+                    {% csrf_token %}
+                    {{ form.as_p }}
+                    <button class="btn btn-success" type="submit">Guardar Cuenta</button>
+                </form>
+            </div>
+        </div>
+
+        <div class="botones">
+            <a href="{% url 'dashboard' %}"><button class="btn btn-secondary" type="button">Volver al Dashboard</button></a>
+        </div>
+    </div>
+</section>  
+{% include "_footer.html" %}

+ 0 - 1
templates/dashboard.html

@@ -33,7 +33,6 @@
     </div>
 
     <div class="board">
-        {% include "_menu.html" %}
         <h2>Balance: {{ balance }}</h2>
         <p>Ingresos: {{ ingresos }} | Gastos: {{ gastos }}</p>