Anyone, knows what to do?
Thanks,
--
Lucas Aride Moulin,
aride.moulin@gmail.com
-- 2012/6/5 Lucas Aride Moulin <aride.moulin@gmail.com>
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 doThe 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.moulin@gmail.com
Lucas Aride Moulin,
aride.moulin@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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment