Hi Lucas, Try moving the first novo=... Right after if request.method
Then dedent the else and the line following it (the second novo) Then remove request.POST from the second novo Explanation: If the request method is not POST this will instanciate an unbound form that loads the data from the instance. If the request method is POST the form is populated using the POST data. If it is valid the instance is saved. If it is not valid django will set the errors on the form Good luck! Hendrik ----- Reply message ----- Von: "Lucas Aride Moulin" <aride.mou...@gmail.com> An: <django-users@googlegroups.com> Betreff: How to edit form filling it with actual data Datum: Di., Jun. 5, 2012 23:07 I have a function that creates a form, loading the info that already exists in the DB, but I want it to fill the form with the info loaded. I found an article on djangoproject teaching how to do this, but it won't work with me. At novo = disciplinaForm(request.POST, instance=atual), if I remove the "request.POST" it loads the info, but don't save. And with "request.POST" it do The function: def edit_disciplina(request, disciplina_id): atual = disciplina.objects.get(pk=disciplina_id) novo = disciplinaForm(request.POST, instance=atual) if request.method == 'POST': if novo.is_valid(): novo.save() return HttpResponseRedirect('/disciplinas/success/') else: novo = disciplinaForm(request.POST, instance=atual) return render_to_response('/home/zephir/Template/disciplinas/edit_disciplina.html', {'novo': novo}, context_instance=RequestContext(request)) -- Lucas Aride Moulin, aride.mou...@gmail.com -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.