Untitled
unknown
plain_text
10 days ago
1.0 kB
10
Indexable
Never
TEMPLATE {% extends "core/base.html" %}{% load static %} {% block content %} <div class="container text-center mt-2"> <h1>Ingreso de nueva mascota</h1> <hr></hr> </div> <div class="container-sm w-50"> <form method="post"> {% csrf_token %} {{mascotasForm}} <button type="submit" class="btn btn-success mt-4 mb-5">ACEPTAR</button> </form> </div> {% endblock content %} VIEW from .forms import MascotasForm # Create your views here. @login_required() def ingresoMascota(request): if request.method == "POST": mascotaForm = MascotasForm(request.POST) if mascotaForm.is_valid(): mascotaForm.save() return redirect( "administracion" ) # Fix hasta solucionar la limpieza de campos messages.success(request, "Se ingresaron correctamente los datos.") else: mascotaForm = MascotasForm() context = {"mascotasForm": mascotaForm} return render(request, "ingresoMascota.html", context)
Leave a Comment