Si estas usando ajax lo que puedes hacer es instalarte django rest framework o crearte una vista que cuando sea get te retorne los datos de la db y cuando sea post los actualice y puedes llamarla desde ajax una primera vez cuando se ejecuta el formulario para rellenarlo y luego cada vez que se hace submit hacer un preventdfault y llamar a la vista por ajax con un método post y si es exitoso llamar con uk get para actualizar el form.
Saludos. Enviado desde mi iPhone > El 25 abr 2019, a las 21:38, Victor H. Velasquez Rizo <rizo.vic...@gmail.com> > escribió: > > Hola Tatiana. > Vira este tutorial en que te guian para que hagas las operaciones basicas de > CRUD (Create, Read, Update, Delete) > > https://www.youtube.com/watch?v=twXF1VpK5ak > > Saludos ! > >> On Thu, Apr 25, 2019 at 10:39 AM Tatiana Mesa <tatianamesa...@gmail.com> >> wrote: >> Hola, >> >> 1.tengo un formulario donde inicialmente lo lleno y guardo unos datos en la >> base. >> 2. hago una consulta para traer esos registros de la base de datos. >> 3. Ahora quiero que en ese mismo formulario, en el inicial, se muestren esos >> datos que guarde en un principio. >> >> para hacer un tipo de update, pero sobre ese mismo formulario, es como si el >> usuario viera lo que guardo en un principio y pueda decidir si quiere >> cambiarlo o no >> >> El jue., 25 de abr. de 2019 a la(s) 09:44, Gil Obradors >> (gil.obrad...@gmail.com) escribió: >>> Buenas, >>> >>> Un update, en caso que los datos ya existen quizas? Sino no lo entiendo? >>> >>> >>> >>> >>> >>> >>> >>> El dj., 25 d’abr. 2019, 16:09, <tatianamesa...@gmail.com> va escriure: >>>> Buen día, >>>> >>>> Vengo trabajando con un formulario en html que captura los datos mediante >>>> AJAX y los guarda en una base de datos postgres. >>>> >>>> Ahora quiero realizar un update, en ese mismo formulario, >>>> >>>> De que manera puedo mostrar los datos que guarde en la base de datos, en >>>> los inputs del formulario, para decidir si quiero dejar esos datos o >>>> quiero actualizarlos. >>>> >>>> >>>> Agradezco mucho sus soluciones. >>>> >>>> >>>> Este es mi formulario en el que guardo inicialmente >>>> >>>> >>>> <form >>>> class="post">{%csrf_token%} >>>> <div >>>> class="articleunique"> >>>> >>>> <input type="" class="id_articulo" name="id_articulo" value="{{ >>>> article.id }}"> >>>> </div> >>>> >>>> <p>Tags</p> >>>> <input >>>> type='text' id="flex" >>>> >>>> placeholder='Write your tags' >>>> >>>> class='flexdatalist data_tags' >>>> >>>> params='["name"]', >>>> >>>> data-search-in='name' >>>> >>>> data-visible-properties='["name"]' >>>> >>>> data-selection-required='true' >>>> >>>> data-value-property='id' >>>> >>>> data-min-length='2' >>>> >>>> multiple='multiple' >>>> >>>> name='country_id_multiple' required> >>>> <div >>>> class="post-form"><br> >>>> >>>> <p>Tono</p> >>>> >>>> <select class="form-control Tono" style=""> >>>> >>>> <option selected></option> >>>> >>>> {% for t in tones %} >>>> >>>> <option value="{{ t }}"> >>>> >>>> {{ t.nombre }} >>>> >>>> </option> >>>> >>>> {% endfor %} >>>> >>>> </select> >>>> >>>> </div><br><br> >>>> <div >>>> class="post-form"> >>>> >>>> <p>Tema</p> >>>> >>>> <div class="nuevo"> >>>> >>>> <!-- Tercer input temas que se crea con la function de Javascript >>>> --> >>>> >>>> <div class="miDiv"></div> >>>> >>>> <button class="btn btn-warning añadir_tema">Añadir Tema</button> >>>> >>>> </div> >>>> >>>> <br> >>>> >>>> <br> >>>> >>>> <div class="btn_seccion1"> >>>> >>>> <input type="button" value="Guardar"class=" btn_save btn >>>> btn-danger guardar" style="width: 150px"> >>>> >>>> </div> >>>> >>>> <br><br> >>>> </div> >>>> </form> >>>> >>>> -- >>>> You received this message because you are subscribed to the Google Groups >>>> "Django users" group. >>>> To unsubscribe from this group and stop receiving emails from it, send an >>>> email to django-users+unsubscr...@googlegroups.com. >>>> To post to this group, send email to django-users@googlegroups.com. >>>> Visit this group at https://groups.google.com/group/django-users. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/django-users/202a9a2b-e6da-49ff-83ec-d884e994b5a9%40googlegroups.com. >>>> For more options, visit https://groups.google.com/d/optout. >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Django users" group. >>> To unsubscribe from this group and stop receiving emails from it, send an >>> email to django-users+unsubscr...@googlegroups.com. >>> To post to this group, send email to django-users@googlegroups.com. >>> Visit this group at https://groups.google.com/group/django-users. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/django-users/CAK-JoTSaJyJogke1fJ-uWbOia5uWt2Eai23HuUensoKPY8AdjA%40mail.gmail.com. >>> For more options, visit https://groups.google.com/d/optout. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to django-users+unsubscr...@googlegroups.com. >> To post to this group, send email to django-users@googlegroups.com. >> Visit this group at https://groups.google.com/group/django-users. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/CAHAr%3D_2%2B04CK3EW_RrL8M25Cukcv3%2BkVrpfX2J6cMjJa0kh36g%40mail.gmail.com. >> For more options, visit https://groups.google.com/d/optout. > > > -- > > > > Atte...,. > Vìctor Hugo Velàsquez Rizo > Cali - Colombia > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAFCXTzhWAhXEDCD8u2ur_jHJQqgy8m2zFetWVS0-OZtYX%2BOuYQ%40mail.gmail.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/51551623-1D1C-4A50-BA7B-02FC3014DAE5%40gmail.com. For more options, visit https://groups.google.com/d/optout.