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,
[email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to